mirror of
https://github.com/bevyengine/bevy
synced 2024-11-10 07:04:33 +00:00
897b13bf9d
# Objective First, some terminology: - **Minor radius**: The radius of the tube of a torus, i.e. the "half-thickness" - **Major radius**: The distance from the center of the tube to the center of the torus - **Inner radius**: The radius of the hole (if it exists), `major_radius - minor_radius` - **Outer radius**: The radius of the overall shape, `major_radius + minor_radius` - **Ring torus**: The familiar donut shape with a hole in the center, `major_radius > minor_radius` - **Horn torus**: A torus that doesn't have a hole but also isn't self-intersecting, `major_radius == minor_radius` - **Spindle torus**: A self-intersecting torus, `major_radius < minor_radius` Different tori from [Wikipedia](https://en.wikipedia.org/wiki/Torus), where *R* is the major radius and *r* is the minor radius: ![kuva](https://github.com/bevyengine/bevy/assets/57632562/53ead786-2402-43a7-ae8a-5720e6e54dcc) Currently, Bevy's torus is represented by a `radius` and `ring_radius`. I believe these correspond to the outer radius and minor radius, but they are rather confusing and inconsistent names, and they make the assumption that the torus always has a ring. I also couldn't find any other big engines using this representation; [Godot](https://docs.godotengine.org/en/stable/classes/class_torusmesh.html) and [Unity ProBuilder](https://docs.unity3d.com/Packages/com.unity.probuilder@4.0/manual/Torus.html) use the inner and outer radii, while [Unreal](https://docs.unrealengine.com/5.3/en-US/BlueprintAPI/GeometryScript/Primitives/AppendTorus/) uses the minor and major radii. [Blender](https://docs.blender.org/manual/en/latest/modeling/meshes/primitives.html#torus) supports both, but defaults to minor/major. Bevy's `Torus` primitive should have an efficient, consistent, clear and flexible representation, and the current `radius` and `ring_radius` properties are not ideal for that. ## Solution Change `Torus` to be represented by a `minor_radius` and `major_radius`. - Mathematically correct and consistent - Flexible, not restricted to ring tori - Computations and conversions are efficient - `inner_radius = major_radius - minor_radius` - `outer_radius = major_radius + minor_radius` - Mathematical formulae for things like area and volume rely on the minor and major radii, no conversion needed Perhaps the primary issue with this representation is that "minor radius" and "major radius" are rather mathematical, and an inner/outer radius can be more intuitive in some cases. However, this can be mitigated with constructors and helpers. |
||
---|---|---|
.. | ||
bevy_a11y | ||
bevy_animation | ||
bevy_app | ||
bevy_asset | ||
bevy_audio | ||
bevy_core | ||
bevy_core_pipeline | ||
bevy_derive | ||
bevy_diagnostic | ||
bevy_dylib | ||
bevy_dynamic_plugin | ||
bevy_ecs | ||
bevy_ecs_compile_fail_tests | ||
bevy_encase_derive | ||
bevy_gilrs | ||
bevy_gizmos | ||
bevy_gltf | ||
bevy_hierarchy | ||
bevy_input | ||
bevy_internal | ||
bevy_log | ||
bevy_macro_utils | ||
bevy_macros_compile_fail_tests | ||
bevy_math | ||
bevy_mikktspace | ||
bevy_pbr | ||
bevy_ptr | ||
bevy_reflect | ||
bevy_reflect_compile_fail_tests | ||
bevy_render | ||
bevy_scene | ||
bevy_sprite | ||
bevy_tasks | ||
bevy_text | ||
bevy_time | ||
bevy_transform | ||
bevy_ui | ||
bevy_utils | ||
bevy_window | ||
bevy_winit |