public class SphereSector extends Model
See https://en.wikipedia.org/wiki/Sphere
By a partial sphere we mean cutting a hole in the sphere around either the north or the south pole (that is, removing a spherical cap from either the top or bottom of the sphere) and also cutting from the sphere a spherical wedge between two lines of longitude.
Notice that we can use this model to both model a spherical wedge and to model a sphere with a spherical wedge removed from it.
Similarly, we can use this model to both model a spherical cap and to model a sphere with a spherical cap removed from it.
See https://en.wikipedia.org/wiki/Spherical_cap
See https://en.wikipedia.org/wiki/Spherical_segment
See https://en.wikipedia.org/wiki/Spherical_wedge
The whole sphere of radius r
is the surface of revolution generated
by revolving the right half-circle in the xy-plane with radius r
and
center (0,0,0)
all the way around the y-axis.
Here are parametric equations for the right half-circle in the xy-plane with
radius r
and center (0,0,0)
, parameterized from the top down.
x(phi) = r * sin(phi) \
y(phi) = r * cos(phi) |- 0 <= phi <= PI
z(phi) = 0 /
Here is the 3D rotation matrix that rotates around the y-axis
by theta
radians, 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 half-circle
parameterization, we get a parameterization of the sphere.
[ cos(theta) 0 sin(theta)] [r * sin(phi)]
[ 0 1 0 ] * [r * cos(phi)]
[-sin(theta) 0 cos(theta)] [ 0 ]
= ( r * sin(phi) * cos(theta). \
r * cos(phi), |- 0<=theta<=2*PI, 0<=phi<=PI
-r * sin(phi) * sin(theta) ) /
See
https://en.wikipedia.org/wiki/Sphere#Equations_in_three-dimensional_spaceSphere
hidden, lineSegmentList
Constructor and Description |
---|
SphereSector()
Create half of a sphere of radius 1 centered at the origin.
|
SphereSector(double r,
double theta1,
double theta2,
double phi1,
double phi2,
int n,
int k)
Create a part of the sphere of radius r centered at the origin.
|
SphereSector(double r,
double theta1,
double theta2,
int n,
int k)
Create a part of the sphere of radius r centered at the origin.
|
public SphereSector()
public SphereSector(double r, double theta1, double theta2, double phi1, double phi2, int n, int k)
If phi1 > 0
, then there is hole in the sphere around its
north pole. Similarly, if phi2 < PI
, then there is a hole
in the sphere around its south pole. In other words, in spherical
coordinates, lines of longitude in the model extend from angle
phi1
to angle phi2
.
If theta1 > 0
or theta2 < 2*PI
, then a spherical
wedge is removed from the model. 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 lines of longitude and the number of (partial) circles of latitude in the model.
Notice that if there are k
lines of longitude, then each
(partial) circle of latitude will have k-1
line segments.
If there are n
circles of latitude (including the edges of
the removed spherical caps), then each line of longitude will have
n-1
line segments.
There must be at least four lines of longitude and at least three circles of latitude.
r
- radius of the spheretheta1
- beginning longitude angle of the spherical wedgetheta2
- ending longitude angle of the spherical wedgephi1
- beginning latitude angle of the spherical segmentphi2
- ending latitude angle of the spherical segmentn
- number of circles of latitude, not counting the edges of a spherical segmentk
- number of lines of longitude, not counting one edge of a spherical wedgepublic SphereSector(double r, double theta1, double theta2, int n, int k)
If theta1 > 0
or theta2 < 2*PI
, then a spherical
wedge is removed from the model. 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 half circles of longitude and the number of (partial) circles of latitude in the model.
Notice that if there are k
half circles of longitude, then
each (partial) circle of latitude will have k-1
line segments.
If there are n
circles of latitude, then each half circle of
longitude will have n+1
line segments.
There must be at least four half circles of longitude and at least one circle of latitude.
r
- radius of the spheretheta1
- beginning longitude angle of the spherical wedgetheta2
- ending longitude angle of the spherical wedgen
- number of circles of latitudek
- number of lines of longitude, not counting the edges of a spherical wedge