Torus
Classes have a wide range of application scenarios when animating in math, physics or engineering.
For example, the dynamic demonstration of topological transformations (e.g., internal and external flipping, twisting, etc.) of a ring surface helps us to visualize concepts such as topological invariants and cohomology;
It is also possible to simulate the distribution and motion of magnetic field lines in a ring surface conductor, demonstrate the phenomenon of electromagnetic induction, and so on.
This article describes the main parameters and basic usage of Torus.
1. Main parameters
Torus
There are few parameters, mainly:
Parameter name | typology | clarification |
---|---|---|
major_radius | float | The major radius of a circular ring surface, the distance from the center of the ring surface to the center of its pipe (or called the central axis of the ring surface) |
minor_radius | float | Radius of the pipe at the ring surface |
resolution | [int, int] | Resolution of the ring surface, used to control the fineness of the rendering |
u_range | [float] | defines the range of parameterization of the circular surface in the u-direction |
v_range | [float] | defines the range of parameterization of the circular surface in the v-direction |
If theTorus
If the circular surface is viewed as a tire
So.major_radius
parameter indicates the size of the tire.minor_radius
The parameter indicates the thickness of the tire.
2. Examples of use
In order to effectively demonstrateTorus
(circular surfaces) the use of individual parameters, four examples of which are constructed below.
Each example will highlightTorus
class with one or a few key parameters, and describes how these parameters affect the appearance and properties of the ring surface.
2.1 Standard circular surfaces
This is a standard ring surface wheremajor_radius
determines the size of the ring surface.minor_radius
determines the thickness of the pipe at the ring surface.
(indicates contrast)resolution
Controls the smoothness of the ring surface.
By adjusting these parameters, ring surfaces of different sizes and shapes can be obtained.
torus = Torus(
major_radius=2.5,
minor_radius=0.5,
resolution=(30, 30),
)
2.2 Flat circular surfaces
By limitingv_range
value, we can create a flat ring surface.
In this example, thev_range
be set to(0, PI/2)
, which means that the ring surface inv-directionThe parameterization range on is limited to a much smaller interval, resulting in a visually flatter ring surface.
This flat ring surface can be used to simulate flat shaped objects such as tires and donuts.
torus = Torus(
major_radius=2.5,
minor_radius=0.5,
resolution=(30, 30),
v_range=(0, PI / 2),
)
2.3 High-resolution circular surfaces
riseresolution
value improves the smoothness and level of detail of the ring surface.
In this example, theresolution
be set to(100, 100)
, which means that the ring surface inu and v directionsThe higher resolution on all of them results in a more detailed and realistic curved surface effect.
High-resolution ring surfaces are useful when rendering complex scenes or creating high-quality animations.
torus = Torus(
major_radius=2.5,
minor_radius=0.5,
resolution=(100, 100),
)
2.4 Non-standard circular surfaces
By adjustingu_range
value, we can create a non-standard ring surface.
In this example, theu_range
be set to(0, 3*PI/2)
, which means that the ring surface inu DirectionThe parameterization range on is extended to a larger interval, resulting in a visually missing portion of the ring surface.
Such non-standard ring surfaces can be used in areas such as artistic creation, mathematical visualization or physical simulation to demonstrate the versatility and flexibility of ring surfaces under different parameter settings.
torus = Torus(
major_radius=2.5,
minor_radius=0.5,
resolution=(30, 30),
u_range=(0, 3 * PI / 2),
)
3. Annexes
The code in the article is just an extract of the key parts, the complete code is shared on a web disk (),
Download at.Full Code (Access code: 6872)