public class TorusSector extends Model
See https://en.wikipedia.org/wiki/Torus
This partial torus is the surface of revolution generated by revolving
a sector of the circle in the xy-plane with radius r2
and center
(r1,0,0)
part way around the y-axis. We are assuming that
r1 > r2
.
The whole torus is the surface of revolution generated by revolving
the whole circle in the xy-plane with radius r2
and center
(r1,0,0)
all the way around the y-axis.
Here are parametric equations for the circle in the xy-plane with
radius r2
and center (r1,0,0)
and parameterized
starting from the top, with parameter 0 <= phi <= 2*PI
.
x(phi) = r1 + r2 * sin(phi)
y(phi) = r2 * cos(phi)
z(phi) = 0
Here is the 3D rotation matrix that rotates around the y-axis
by theta
radians with 0 <= theta <= 2*PI
.
[ cos(theta) 0 sin(theta)]
[ 0 1 0 ]
[-sin(theta) 0 cos(theta)]
If we multiply the rotation matrix with the circle parameterization,
we get a parameterization of the torus.
[ cos(theta) 0 sin(theta)] [r1 + r2 * sin(phi)]
[ 0 1 0 ] * [ r2 * cos(phi)]
[-sin(theta) 0 cos(theta)] [ 0 ]
= ( r1*cos(theta) + r2*cos(theta)*sin(phi).
r2*cos(phi),
-r1*sin(theta) - r2*sin(theta)*sin(phi) )
= ( (r1 + r2*sin(phi)) * cos(theta),
r2*cos(phi),
-(r1 + r2*sin(phi)) * sin(theta) )
See
http://en.wikipedia.org/wiki/Torus#GeometryTorus
lineSegmentList, vertexList, visible
Constructor and Description |
---|
TorusSector()
Create a partial torus with half the circle of revolution with radius 3/4
and a cross section that is half the circle of longitude with radius 1/4.
|
TorusSector(double r1,
double r2,
double theta1,
double theta2,
double phi1,
double phi2,
int n,
int k)
Create a partial torus with a partial circle of revolution with
radius
r1 and a partial cross section circle with radius
r2 . |
TorusSector(double r1,
double r2,
double theta1,
double theta2,
int n,
int k)
Create a partial torus with a partial circle of revolution
with radius
r1 and a cross section circle (circle of
longitude) with radius r2 . |
addLineSegment, addLineSegment, addVertex, setColor, setColorRandom, setRandomColors, setRandomLineSegmentColors, toString
public TorusSector()
public TorusSector(double r1, double r2, double theta1, double theta2, double phi1, double phi2, int n, int k)
r1
and a partial cross section circle with radius
r2
.
If phi1 > 0
or phi2 < 2*PI
, then the (partial) cross
section circle is the circular sector from angle phi1
to angle
phi2
. In other words, the (partial) circles of logitude in the
model extend from angle phi1
to angle phi2
.
If theta1 > 0
or theta2 < 2*PI
, then the (partial) circle
of revolution is the circular sector from angle theta1
to angle
theta2
. In other words, the (partial) circles of latitude in
the model extend from angle theta1
to angle theta2
.
The last two parameters determine the number of (partial) circles of longitude and the number of (partial) circles of latitude in the model.
Notice that if there are k
circles of longitude, then each
(partial) circle of latitude will have k-1
line segments.
If there are n
(partial) circles of latitude, then each
circle of longitude will have n-1
line segments.
There must be at least four circles of longitude and at least four circles of latitude.
r1
- radius of the circle of revolutionr2
- radius of the cross section circle (circle of longitude)theta1
- beginning longitude angle for the circle of revolutiontheta2
- ending longitude angle for the circle of revolutionphi1
- beginning latitude angle for the cross section circlephi2
- ending latitude angle for the cross section circlen
- number of circles of latitudek
- number of circles of longitudepublic TorusSector(double r1, double r2, double theta1, double theta2, int n, int k)
r1
and a cross section circle (circle of
longitude) with radius r2
.
If theta1 > 0
or theta2 < 2*PI
, then the (partial)
circle of revolution is the circular sector from angle theta1
to angle theta2
. In other words, the (partial) circles of
latitude in the model extend from angle theta1
to angle
theta2
.
The last two parameters determine the number of circles of longitude and the number of (partial) circles of latitude in the model.
Notice that if there are k
circles of longitude, then each
(partial) circle of latitude will have k-1
line segments.
If there are n
(partial) circles of latitude, then each circle
of longitude will have n
line segments.
There must be at least four circles of longitude and at least three circles of latitude.
r1
- radius of the circle of revolutionr2
- radius of the cross section circle (circle of longitude)theta1
- beginning longitude angle for the circle of revolutiontheta2
- ending longitude angle for the circle of revolutionn
- number of circles of latitudek
- number of circles of longitude