Package org.locationtech.jts.geom.util
Class SineStarFactory
- java.lang.Object
-
- org.locationtech.jts.util.GeometricShapeFactory
-
- org.locationtech.jts.geom.util.SineStarFactory
-
public class SineStarFactory extends GeometricShapeFactory
Creates geometries which are shaped like multi-armed stars with each arm shaped like a sine wave. These kinds of geometries are useful as a more complex geometry for testing algorithms.- Author:
- Martin Davis
-
-
Constructor Summary
Constructors Constructor Description SineStarFactory()
Creates a factory which will create sine stars using the defaultGeometryFactory
.SineStarFactory(GeometryFactory geomFact)
Creates a factory which will create sine stars using the givenGeometryFactory
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Geometry
create(Coordinate origin, double size, int nPts, int nArms, double armLengthRatio)
Creates a sine star with the given parameters.Geometry
createSineStar()
Generates the geometry for the sine starvoid
setArmLengthRatio(double armLengthRatio)
Sets the ratio of the length of each arm to the radius of the star.void
setNumArms(int numArms)
Sets the number of arms in the star-
Methods inherited from class org.locationtech.jts.util.GeometricShapeFactory
createArc, createArcPolygon, createCircle, createEllipse, createRectangle, createSquircle, createSupercircle, setBase, setCentre, setEnvelope, setHeight, setNumPoints, setRotation, setSize, setWidth
-
-
-
-
Constructor Detail
-
SineStarFactory
public SineStarFactory()
Creates a factory which will create sine stars using the defaultGeometryFactory
.
-
SineStarFactory
public SineStarFactory(GeometryFactory geomFact)
Creates a factory which will create sine stars using the givenGeometryFactory
.- Parameters:
geomFact
- the factory to use
-
-
Method Detail
-
create
public static Geometry create(Coordinate origin, double size, int nPts, int nArms, double armLengthRatio)
Creates a sine star with the given parameters.- Parameters:
origin
- the origin pointsize
- the size of the starnPts
- the number of points in the starnArms
- the number of arms to generatearmLengthRatio
- the arm length ratio- Returns:
- a sine star shape
-
setNumArms
public void setNumArms(int numArms)
Sets the number of arms in the star- Parameters:
numArms
- the number of arms to generate
-
setArmLengthRatio
public void setArmLengthRatio(double armLengthRatio)
Sets the ratio of the length of each arm to the radius of the star. A smaller number makes the arms shorter. Value should be between 0.0 and 1.0- Parameters:
armLengthRatio
- the ratio determining the length of them arms.
-
createSineStar
public Geometry createSineStar()
Generates the geometry for the sine star- Returns:
- the geometry representing the sine star
-
-