Package renderer.models_L
Class CircleSector
- java.lang.Object
-
- renderer.scene.Model
-
- renderer.models_L.CircleSector
-
- All Implemented Interfaces:
MeshMaker
public class CircleSector extends Model implements MeshMaker
Create a wireframe model of an arc from a circle in the xy-plane centered at the origin.- See Also:
DiskSector
,RingSector
,ConeSector
,CylinderSector
,SphereSector
,TorusSector
-
-
Field Summary
Fields Modifier and Type Field Description int
n
double
r
double
theta1
double
theta2
-
Fields inherited from class renderer.scene.Model
colorList, name, primitiveList, vertexList, visible
-
-
Constructor Summary
Constructors Constructor Description CircleSector()
Create half of a circle in the xy-plane with radius 1 and with 8 line segments around the circumference.CircleSector(double r)
Create half of a circle in the xy-plane with radiusr
and with 8 line segments around the circumference.CircleSector(double r, double theta1, double theta2, int n)
Create an arc (a sector) of a circle in the xy-plane with radiusr
, starting angletheta1
, ending angletheta2
, and withn
line segments around the circumference.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getHorzCount()
int
getVertCount()
CircleSector
remake(int n, int k)
Build an instance of theModel
with new values for the number of lines of latitude and longitude while keeping all the other model parameters the same.-
Methods inherited from class renderer.scene.Model
addColor, addPrimitive, addVertex, getPrimitive, toString
-
-
-
-
Constructor Detail
-
CircleSector
public CircleSector()
Create half of a circle in the xy-plane with radius 1 and with 8 line segments around the circumference.
-
CircleSector
public CircleSector(double r)
Create half of a circle in the xy-plane with radiusr
and with 8 line segments around the circumference.- Parameters:
r
- radius of the circle
-
CircleSector
public CircleSector(double r, double theta1, double theta2, int n)
Create an arc (a sector) of a circle in the xy-plane with radiusr
, starting angletheta1
, ending angletheta2
, and withn
line segments around the circumference.The arc is drawn counterclockwise starting at angle
theta1
and ending at angletheta2
. Notice that this means that iftheta1 <= theta2
, then we are drawing the arc between the angles, but iftheta1 > theta2
, then we are removing the arc between the angles.Notice that any two angles define two arcs from a circle. We want a definition for this method that unambiguously determines, for any two angles, which of the two arcs to draw.
- Parameters:
r
- radius of the circletheta1
- beginning angle of the sector (in radians)theta2
- ending angle of the sector (in radians)n
- number of line segments in the circle's circumference- Throws:
IllegalArgumentException
- ifn
is less than 3
-
-
Method Detail
-
getHorzCount
public int getHorzCount()
- Specified by:
getHorzCount
in interfaceMeshMaker
- Returns:
- the number of lines of latitude that the
Model
contains
-
getVertCount
public int getVertCount()
- Specified by:
getVertCount
in interfaceMeshMaker
- Returns:
- the number of lines of longitude that the
Model
contains
-
remake
public CircleSector remake(int n, int k)
Description copied from interface:MeshMaker
Build an instance of theModel
with new values for the number of lines of latitude and longitude while keeping all the other model parameters the same.
-
-