Class PGS_Construction
- Author:
- Michael Carleton
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic processing.core.PShape
createArbelos
(double centerX, double centerY, double radius, double notchPosition) Creates an Arbelos shape, a mathematical figure bounded by three semicircles.static processing.core.PShape
createArc
(double centerX, double centerY, double width, double height, double orientation, double angle) Creates an elliptical arc polygon—a filled "slice" of an ellipse defined by the specified arc and the two radii connecting its endpoints to the ellipse center.static processing.core.PShape
createBlobbie
(double centerX, double centerY, double maxWidth, double a, double b, double c, double d) Generates a "blobbie" shape—a deformable, organic, blobby closed curve defined by four parameters.static processing.core.PShape
createCircle
(double x, double y, double r) Creates a circle of radius r centered on (x,y).static processing.core.PShape
createCircle
(processing.core.PVector c) Creates a geometric circle of radius r (.z) centered on (x,y).static processing.core.PShape
createFermatSpiral
(double centerX, double centerY, double coils, double outerRadius) Creates Fermat's spiral, a parabolic spiral which is symmetrical about the origin.static processing.core.PShape
createGear
(double centerX, double centerY, double radius, int n) Creates a gear shape from a parametric gear curve.static processing.core.PShape
createHeart
(double centerX, double centerY, double width) Creates a classic "heart" shape using a parametric curve, centered and scaled as specified.static processing.core.PShape
createHilbertCurve
(double width, double height, int order) Creates a Hilbert Curve shape, a type of plane-filling curve.static processing.core.PShape
createHobbyCurve
(List<processing.core.PVector> points, double tension) Creates a Hobby Curve from the given list of control points using the specified tension.static processing.core.PShape
createHobbyCurve
(List<processing.core.PVector> points, double tension, double endPointCurl) Create a Hobby Curve from the given list of control points using the specified tension and endpoint curl parameter.static processing.core.PShape
createKochSnowflake
(double width, double height, int order) Creates a Koch Snowflake shape, a fractal curve.static processing.core.PShape
createLinearSpiral
(double centerX, double centerY, double coils, double outerRadius) Creates an linear/archimedean spiral shape, where the distance between any 2 successive windings is constant.static processing.core.PShape
createRandomBezierPolygon
(int nPoints, double scale, double radius, double spikiness, long seed) Generates a smooth or spiky random polygon comprising Bezier curves.static processing.core.PShape
createRandomPolygon
(int n, double maxWidth, double maxHeight) Generates a random simple convex polygon (n-gon).static processing.core.PShape
createRandomPolygon
(int n, double maxWidth, double maxHeight, long seed) Generates a random simple convex polygon (n-gon), having a given random seed.static processing.core.PShape
createRandomPolygonExact
(int n, double width, double height) Generates a random simple convex polygon (n-gon), where the output's bounding box has the dimensions of those specified.static processing.core.PShape
createRandomPolygonExact
(int n, double width, double height, long seed) Generates a random simple convex polygon (n-gon), where the output's bounding box has the dimensions of those specified.static processing.core.PShape
createRandomSFCurve
(int nColumns, int nRows, double cellWidth, double cellHeight) Creates a random space-filling curve.static processing.core.PShape
createRandomSFCurve
(int nColumns, int nRows, double cellWidth, double cellHeight, long seed) Creates a random space-filling curve, having a specific random seed.static processing.core.PShape
createRect
(double a, double b, double c, double d, double r) Shortcut for creating a rectangle with uniformly rounded corners, usingPConstants.CORNER
mode.static processing.core.PShape
createRect
(int rectMode, double a, double b, double c, double d, double r) Creates a rectangle with specified corner radii, in any Processing-style rectangle mode.static processing.core.PShape
createRectangularSpiral
(double x, double y, double width, double height, double spacing) Creates a rectangular-shaped spiral shape.static processing.core.PShape
createRegularPolyon
(int n, double centerX, double centerY, double width) Generates an N-sided regular polygon.static processing.core.PShape
createRing
(double centerX, double centerY, double outerRadius, double innerRadius) Creates a joined ring (a "donut") shape.static processing.core.PShape
createRing
(double centerX, double centerY, double outerRadius, double innerRadius, double orientation, double angle) Creates an (un)joined ring shape.static processing.core.PShape
createSierpinskiCarpet
(double width, double height, int order) Creates a Sierpiński Carpet shape, a type of plane fractal.static processing.core.PShape
createSierpinskiCurve
(double centerX, double centerY, double width, int curveOrder) Creates a closed Sierpiński curve (a recursive space-filling curve), having a user-defined degree/order.static processing.core.PShape
createSierpinskiTriCurve
(PGS_Construction.SierpinskiTriCurveType type, double width, int order) Creates one of a family of trifurcating Sierpinski curves.static processing.core.PShape
createSponge
(double width, double height, int generators, double thickness, double smoothing, int classes, long seed) Creates a sponge-like porous structure.static processing.core.PShape
createStar
(double centerX, double centerY, int numRays, double innerRadius, double outerRadius, double roundness) Creates a star shape, having a specified number of rays.static processing.core.PShape
createSupercircle
(double centerX, double centerY, double diameter, double power) Generates a supercircle (also known as a superellipse or Lamé curve) shape centered at the specified coordinates.static processing.core.PShape
createSuperRandomPolygon
(double dimensions, int cells, double markFraction, int smoothing, int depth, boolean orthogonal, boolean holes, long seed) Generates a highly customisable random polygon based on a square grid of NxN cells.static processing.core.PShape
createSuperShape
(double centerX, double centerY, double radius, double m, double n1, double n2, double n3) Generates a supershape using the superformula, centered at the specified coordinates.static processing.core.PShape
createTaijitu
(double centerX, double centerY, double radius) Creates a Taijitu shape (a geometric representation of the Taoist symbol of yin and yang).static processing.core.PShape
createTeardrop
(double centerX, double centerY, double height, double m) Creates a teardrop shape using a parametric polar curve, centered and scaled as specified.
-
Method Details
-
createRandomPolygon
public static processing.core.PShape createRandomPolygon(int n, double maxWidth, double maxHeight) Generates a random simple convex polygon (n-gon).- Parameters:
n
- number of polygon vertices/sidesmaxWidth
- maximum width of generated random polygonmaxHeight
- maximum height of generated random polygon- Returns:
- a PShape representing the generated polygon
-
createRandomPolygon
public static processing.core.PShape createRandomPolygon(int n, double maxWidth, double maxHeight, long seed) Generates a random simple convex polygon (n-gon), having a given random seed.- Parameters:
n
- number of polygon vertices/sidesmaxWidth
- maximum width of generated random polygonmaxHeight
- maximum height of generated random polygonseed
- a seed value used to generate the random polygon (optional)- Returns:
- a PShape representing the generated polygon
-
createRandomPolygonExact
public static processing.core.PShape createRandomPolygonExact(int n, double width, double height) Generates a random simple convex polygon (n-gon), where the output's bounding box has the dimensions of those specified.- Parameters:
n
- number of polygon vertices/sideswidth
- width of generated random polygonheight
- height of generated random polygon- Returns:
- a PShape representing the generated polygon
-
createRandomPolygonExact
public static processing.core.PShape createRandomPolygonExact(int n, double width, double height, long seed) Generates a random simple convex polygon (n-gon), where the output's bounding box has the dimensions of those specified.- Parameters:
n
- number of polygon vertices/sideswidth
- width of generated random polygonheight
- height of generated random polygonseed
- a seed value used to generate the random polygon- Returns:
- a PShape representing the generated polygon
-
createRegularPolyon
public static processing.core.PShape createRegularPolyon(int n, double centerX, double centerY, double width) Generates an N-sided regular polygon.- Parameters:
n
- number of sidescenterX
- centre point XcenterY
- centre point Ywidth
- polygon width- Since:
- 2.0
-
createSupercircle
public static processing.core.PShape createSupercircle(double centerX, double centerY, double diameter, double power) Generates a supercircle (also known as a superellipse or Lamé curve) shape centered at the specified coordinates.The supercircle is defined by the equation |x/a|n + |y/a|n = 1, where the
power
(n) controls the shape's roundness:- power < 1: produces star-like (concave) forms
- power = 1: produces a square (with rounded corners due to sampling)
- power > 1: increasingly resembles a circle as power increases
- Parameters:
centerX
- the x-coordinate of the supercircle centercenterY
- the y-coordinate of the supercircle centerdiameter
- the diameter of the supercircle (distance from side to side)power
- the exponent controlling the "circularity" (roundness or squareness) of the shape; values < 1 yield star-like shapes, 1 is a square, values > 1 become more circular- Returns:
- a
PShape
representing the generated supercircle
-
createSuperShape
public static processing.core.PShape createSuperShape(double centerX, double centerY, double radius, double m, double n1, double n2, double n3) Generates a supershape using the superformula, centered at the specified coordinates.The superformula is a versatile 2D mathematical equation capable of describing an enormous variety of shapes—ranging from rounded polygons and starfish to petals and snowflakes—depending on parameter choices. See Superformula (Wikipedia) or Paul Bourke's page for details.
Brief parameter effects:
- Equal n-values pinch the form; reducing them increases pinching.
- n₁ larger than n₂/n₃ produces bloated forms.
- Very large n₁, n₂, and n₃ create polygonal shapes.
- Unequal n-values yield asymmetric forms.
- n₁ smaller than n₂/n₃ yields smooth starfish shapes.
- Parameters:
centerX
- the x-coordinate for the center of the supershapecenterY
- the y-coordinate for the center of the supershaperadius
- maximum radius of the supershape (outermost point)m
- symmetry number (e.g. 3 for 3-pointed, 4 for 4-pointed shapes)n1
- superformula parameter controlling general shape (pinching, inflation)n2
- superformula parameter affecting shape symmetryn3
- superformula parameter affecting shape symmetry- Returns:
- a
PShape
instance representing the generated supershape
-
createArc
public static processing.core.PShape createArc(double centerX, double centerY, double width, double height, double orientation, double angle) Creates an elliptical arc polygon—a filled "slice" of an ellipse defined by the specified arc and the two radii connecting its endpoints to the ellipse center.The arc begins at the given orientation angle (measured from the 12 o'clock position, in radians) and extends counterclockwise by the specified angular size. If the arc angle is equal to or greater than 2π, a full ellipse is generated.
The resulting
PShape
is suitable for rendering a pie-slice or sector from an ellipse or circle.- Parameters:
centerX
- the x-coordinate of the ellipse centercenterY
- the y-coordinate of the ellipse centerwidth
- the full width (diameter on the x-axis) of the ellipseheight
- the full height (diameter on the y-axis) of the ellipseorientation
- the starting angle (in radians), where 0 corresponds to "12 o'clock" (upwards)angle
- the arc angle (in radians), defining the sweep of the arc; if equal or greater than 2π, a full ellipse is produced- Returns:
- a
PShape
representing the elliptical arc polygon
-
createTaijitu
public static processing.core.PShape createTaijitu(double centerX, double centerY, double radius) Creates a Taijitu shape (a geometric representation of the Taoist symbol of yin and yang).- Parameters:
centerX
- the x-coordinate of the center of the shapecenterY
- the y-coordinate of the center of the shaperadius
- the radius of the shape- Returns:
- a PShape representing the Taijitu shape
- Since:
- 1.4.0
-
createArbelos
public static processing.core.PShape createArbelos(double centerX, double centerY, double radius, double notchPosition) Creates an Arbelos shape, a mathematical figure bounded by three semicircles.The position of the central notch is arbitrary and can be located anywhere along the diameter.
- Parameters:
centerX
- the x-coordinate of the center of the shapecenterY
- the y-coordinate of the center of the shaperadius
- radius of the largest (enclosing) circlenotchPosition
- the fractional position, between 0 and 1, along the diameter where the notch will be- Returns:
- a PShape representing the Arbelos shape
- Since:
- 1.4.0
-
createStar
public static processing.core.PShape createStar(double centerX, double centerY, int numRays, double innerRadius, double outerRadius, double roundness) Creates a star shape, having a specified number of rays.- Parameters:
centerX
- The x coordinate of the centercenterY
- The y coordinate of the centernumRays
- The number of rays the star hasinnerRadius
- The inner radius of the starouterRadius
- The outer radius of the starroundness
- A roundness value between 0.0 and 1.0, for the inner and outer corners of the star.- Returns:
- The star shape
-
createBlobbie
public static processing.core.PShape createBlobbie(double centerX, double centerY, double maxWidth, double a, double b, double c, double d) Generates a "blobbie" shape—a deformable, organic, blobby closed curve defined by four parameters.The blobbie shape is based on functions involving cosine waves of different frequencies, allowing for smooth, natural-looking deformations. Typical results are lobed or petal-like closed shapes useful in generative graphics or modeling organic phenomena.
To avoid self-intersections, the sum of the parameters
a
andb
should be less than 1. If self-intersection occurs, the result will attempt to be geometrically fixed but may yield unexpected forms. See Paul Bourke: Blobbie for background.r(theta) = (maxWidth/2) * [1 + a*cos(2θ + c) + b*cos(3θ + d)]
- Parameters:
centerX
- the x-coordinate of the blobbie centercenterY
- the y-coordinate of the blobbie centermaxWidth
- the maximum width (diameter) of the blobbiea
- 2-lobed deformation parameter; together with b, controls the main shape undulations (a + b < 1 for simple forms)b
- 3-lobed deformation parameter; see note abovec
- phase offset for the 2-lobed termd
- phase offset for the 3-lobed term- Returns:
- a
PShape
representing the generated blobbie shape - Since:
- 1.3.0
-
createHeart
public static processing.core.PShape createHeart(double centerX, double centerY, double width) Creates a classic "heart" shape using a parametric curve, centered and scaled as specified.The curve is based on the well-known heart equations, producing a symmetric heart that is widest at the center and comes to a point below.
The maximum width parameter controls the distance across the heart at its widest part.
See Heart Curve (MathWorld) for the mathematical reference.
- Parameters:
centerX
- the x-coordinate for the center of the heart shapecenterY
- the y-coordinate for the center of the heart shapewidth
- the maximum width (horizontal extent) of the heart- Returns:
- a
PShape
representing the generated heart curve - Since:
- 1.1.0
-
createTeardrop
public static processing.core.PShape createTeardrop(double centerX, double centerY, double height, double m) Creates a teardrop shape using a parametric polar curve, centered and scaled as specified.This method generates a classic teardrop or droplet outline, where the parameter
m
controls the taper and sharpness of the pointed end. Lower values form
(such as 2) create softer drops, while higher values (up to 5) yield sharper, pointier ends.The generated
PShape
is suitable for use in generative design, infographics, and iconography.See Teardrop Curve (MathWorld) for mathematical background.
- Parameters:
centerX
- the x-coordinate of the center of the teardrop shapecenterY
- the y-coordinate of the center of the teardrop shapeheight
- the full vertical height of the teardrop, from its base to tipm
- the order/tapering factor of the curve; recommended range is 2–5 for visually pleasing shapes- Returns:
- a
PShape
representing the teardrop outline - Since:
- 1.4.0
-
createGear
public static processing.core.PShape createGear(double centerX, double centerY, double radius, int n) Creates a gear shape from a parametric gear curve.- Parameters:
centerX
- The x coordinate of the center of the gearcenterY
- The y coordinate of the center of the gearradius
- maximum radius of gear teethn
- number of gear teeth- Returns:
- the gear shape
- Since:
- 1.4.0
-
createRing
public static processing.core.PShape createRing(double centerX, double centerY, double outerRadius, double innerRadius) Creates a joined ring (a "donut") shape.- Parameters:
centerX
- the x coordinate of the centercenterY
- the y coordinate of the centerouterRadius
- radius of ring exteriorinnerRadius
- radius of ring hole- Returns:
- the ring shape
- Since:
- 1.1.3
-
createRing
public static processing.core.PShape createRing(double centerX, double centerY, double outerRadius, double innerRadius, double orientation, double angle) Creates an (un)joined ring shape.- Parameters:
centerX
- the x coordinate of the centercenterY
- the y coordinate of the centerouterRadius
- radius of ring exteriorinnerRadius
- radius of ring holeorientation
- start angle/orientation in radians (where 0 is 12 o'clock)angle
- size of the ring arc angle in radians- Returns:
- the ring shape
- Since:
- 1.1.3
-
createSponge
public static processing.core.PShape createSponge(double width, double height, int generators, double thickness, double smoothing, int classes, long seed) Creates a sponge-like porous structure.The sponge structure is formed by randomly merging adjacent cells of a Voronoi tessellation and then smoothing them; the final structure is obtained by subtracting that result from a rectangle.
- Parameters:
width
- the width of the sponge boundsheight
- the height of the sponge boundsgenerators
- the number of generator points for the underlying Voronoi tessellation. Should be >5.thickness
- thickness of sponge structure wallssmoothing
- the cell smoothing factor which determines how rounded the cells are. a value of 6 is a good starting point.classes
- the number of classes to use for the cell merging process, where lower results in more merging (or larger "blob-like" shapes).seed
- the seed for the random number generator- Returns:
- the sponge shape
- Since:
- 1.4.0
-
createLinearSpiral
public static processing.core.PShape createLinearSpiral(double centerX, double centerY, double coils, double outerRadius) Creates an linear/archimedean spiral shape, where the distance between any 2 successive windings is constant.- Parameters:
centerX
- the x coordinate of the spiral center point / origincenterY
- the y coordinate of the spiral center point / origincoils
- number of coils/rotations in the spiralouterRadius
- the outer-most radius of the spiral / final coil- Returns:
- a stroked PATH PShape
- Since:
- 1.2.0
-
createFermatSpiral
public static processing.core.PShape createFermatSpiral(double centerX, double centerY, double coils, double outerRadius) Creates Fermat's spiral, a parabolic spiral which is symmetrical about the origin.- Parameters:
centerX
- the x coordinate of the spiral center point / origincenterY
- the y coordinate of the spiral center point / origincoils
- number of coils/rotations in the spiralouterRadius
- the outer-most radius of the spiral / final coil- Returns:
- a stroked PATH PShape
- Since:
- 1.2.0
-
createRectangularSpiral
public static processing.core.PShape createRectangularSpiral(double x, double y, double width, double height, double spacing) Creates a rectangular-shaped spiral shape.- Parameters:
x
- x position of the top-left of spiraly
- y position of the top-left of spiralwidth
- width of outer-most coilheight
- height of outer-most coilspacing
- the distance between successive coils- Returns:
- a stroked PATH PShape with SQUARE stroke cap and MITER joins
- Since:
- 1.3.0
-
createRandomSFCurve
public static processing.core.PShape createRandomSFCurve(int nColumns, int nRows, double cellWidth, double cellHeight) Creates a random space-filling curve.A space-filling curve is a continuous curve that (in this case) traverses every cell of a grid exactly once.
- Parameters:
nColumns
- number of columns in the underlying gridnRows
- number of rows in the underlying gridcellWidth
- visual/pixel width of each cellcellHeight
- visual/pixel width of each cell- Returns:
- a stroked PATH PShape
- Since:
- 1.4.0
- See Also:
-
createRandomSFCurve
public static processing.core.PShape createRandomSFCurve(int nColumns, int nRows, double cellWidth, double cellHeight, long seed) Creates a random space-filling curve, having a specific random seed.A space-filling curve is a continuous curve that (in this case) traverses every cell of a grid exactly once.
- Parameters:
nColumns
- number of columns in the underlying gridnRows
- number of rows in the underlying gridcellWidth
- visual/pixel width of each cellcellHeight
- visual/pixel width of each cellseed
- random seed- Returns:
- a mitered stroked PATH PShape
- Since:
- 1.4.0
- See Also:
-
createSuperRandomPolygon
public static processing.core.PShape createSuperRandomPolygon(double dimensions, int cells, double markFraction, int smoothing, int depth, boolean orthogonal, boolean holes, long seed) Generates a highly customisable random polygon based on a square grid of NxN cells.The number of vertices of the polygon generated is not configurable, but depends on the size of
cells
and the percentagemarkPercent
: for larger values ofcells
, the more vertices the polygon tends to have for a given markPercent.Visually pleasing "random" polygons can be achieved by selecting fairly small values for markFraction, e.g.,
markFraction=0.1
or evenmarkPercent=0.01
.- Parameters:
dimensions
- pixel dimensions of the polygon in its longest axis.cells
- the number of cells in the X and Y directions of the grid.markFraction
- The fraction of vertices marked on the grid. The larger the percentage, the more vertices the polygon tends to have. Should generally be between 0...0.5.holes
- If true, generates a holes in the polygon.orthogonal
- Whether the polygon vertices lie exactly on integer grid points and only form horizontal and vertical lines.smoothing
- The number of rounds of corner cutting to apply to the polygon. A small positive integer value is recommended. A value of 3 is probably sufficient.depth
- The number of rounds of recursive refinement to apply to the polygon generated. A small positive integer value is recommended. This is akin to increasing the depth of fractal curve.seed
- the seed for the random number generator- Since:
- 1.4.0
-
createRandomBezierPolygon
public static processing.core.PShape createRandomBezierPolygon(int nPoints, double scale, double radius, double spikiness, long seed) Generates a smooth or spiky random polygon comprising Bezier curves.- Parameters:
nPoints
- The number of bezier curves the polygon consists of.scale
- Polygon scale. Determines the maximum width or height the polygon could have.radius
- The radius relative to the distance between adjacent points. The radius is used to position the control points of the bezier curve, should be between 0 and 1. Larger values result in sharper features on the curve.spikiness
- A measure of the curve's smoothness. If 0, the curve's angle through each point will be the average between the direction to adjacent points. As it increases, the angle will be determined mostly by one adjacent point, making the curve more "spiky".seed
- the seed for the random number generator- Returns:
- the random polygon shape
- Since:
- 1.4.0
-
createSierpinskiCurve
public static processing.core.PShape createSierpinskiCurve(double centerX, double centerY, double width, int curveOrder) Creates a closed Sierpiński curve (a recursive space-filling curve), having a user-defined degree/order.- Parameters:
centerX
- the x coordinate of the curve center pointcenterY
- the y coordinate of the curve center pointwidth
- length (the maximum width and height) of the curve (the curve will approach this width as the curve order is increased and more space is filled)curveOrder
- the order of the curve (the number of recursive subdivisions). Must be 1 or greater.- Returns:
- a Sierpiński curve of the specified order
- Since:
- 1.2.0
-
createHilbertCurve
public static processing.core.PShape createHilbertCurve(double width, double height, int order) Creates a Hilbert Curve shape, a type of plane-filling curve.- Parameters:
width
- pixel width of the curveheight
- pixel height of the curveorder
- order of the hilbert curve. should be at least 0- Returns:
- a stroked PATH PShape, anchored at (0, 0)
- Since:
- 1.3.0
-
createHobbyCurve
public static processing.core.PShape createHobbyCurve(List<processing.core.PVector> points, double tension) Creates a Hobby Curve from the given list of control points using the specified tension. This is a convenience overload that uses a default endpoint curl of 0.5.The first and last points may be equal; in that case the curve will be treated as closed.
- Parameters:
points
- the list of vertices to use as the basis for the Hobby Curve. Must be non-null and contain at least two points.tension
- a parameter controlling the tightness of the curve. Higher values generally produce tighter curves. A suitable domain is approximately [0.666..., 3]. Values below 0.1 are clamped to 0.1 to avoid degeneracy.- Returns:
- a PShape representing the resulting Hobby Curve composed of cubic Bezier segments.
- Since:
- 2.1
-
createHobbyCurve
public static processing.core.PShape createHobbyCurve(List<processing.core.PVector> points, double tension, double endPointCurl) Create a Hobby Curve from the given list of control points using the specified tension and endpoint curl parameter.The curve is constructed from cubic Bezier segments. If the first and last points are equal the curve will be treated as closed (continuous), and the endpoint curl parameter is effectively ignored for continuity.
- Parameters:
points
- the list of vertices to use as the basis for the Hobby Curve. Must be non-null and contain at least two points.tension
- a parameter controlling the tightness of the curve. Higher values generally produce tighter curves. A suitable domain is approximately [0.666..., 3]. Values below 0.1 are clamped to 0.1 to avoid degeneracy.endPointCurl
- a tuning parameter that controls the "curl" at the start and end of the curve; typical default is 0.5. When the curve is closed this value is ignored.- Returns:
- a PShape representing the resulting Hobby Curve composed of cubic Bezier segments.
- Since:
- 2.1
-
createSierpinskiCarpet
public static processing.core.PShape createSierpinskiCarpet(double width, double height, int order) Creates a Sierpiński Carpet shape, a type of plane fractal.- Parameters:
width
- pixel width of the curveheight
- pixel height of the curveorder
- the number of recursive subdivisions (at least 0, probably no more than 5)- Returns:
- carpet shape, anchored at (0, 0)
- Since:
- 1.3.0
-
createKochSnowflake
public static processing.core.PShape createKochSnowflake(double width, double height, int order) Creates a Koch Snowflake shape, a fractal curve.- Parameters:
width
- pixel width of the curve's envelopeheight
- pixel width of the curve's envelopeorder
- the number of recursive subdivisions (at least 0)- Returns:
- snowflake shape, whose envelope is anchored at (0, 0)
- Since:
- 1.3.0
-
createSierpinskiTriCurve
public static processing.core.PShape createSierpinskiTriCurve(PGS_Construction.SierpinskiTriCurveType type, double width, int order) Creates one of a family of trifurcating Sierpinski curves.- Parameters:
type
- the type of tri-curve: {TRI, TETRA, PENTA, DECA}width
- pixel width of the curve's envelopeorder
- the number of recursive subdivisions (at least 1)- Returns:
- curve shape, anchored at (0, 0)
- Since:
- 1.3.0
-
createRect
public static processing.core.PShape createRect(double a, double b, double c, double d, double r) Shortcut for creating a rectangle with uniformly rounded corners, usingPConstants.CORNER
mode.This convenience method creates a rectangle where all four corners have the same radius
r
. The rectangle uses Processing'sPConstants.CORNER
mode coordinates:(a, b)
specify the top-left corner, andc
andd
specify width and height, respectively.- Parameters:
a
- the x-coordinate of the top-left corner of the rectangleb
- the y-coordinate of the top-left corner of the rectanglec
- the width of the rectangled
- the height of the rectangler
- the uniform radius to be applied to all four corners (0
gives a regular rectangle)- Returns:
- a
PShape
representing the rounded rectangle - Since:
- 2.1
-
createRect
public static processing.core.PShape createRect(int rectMode, double a, double b, double c, double d, double r) Creates a rectangle with specified corner radii, in any Processing-style rectangle mode.The meaning of the
a
,b
,c
, andd
parameters depends on therectMode
:PConstants.CORNER
:(a, b)
is the top-left corner;c
is width,d
is heightPConstants.CORNERS
:(a, b)
is the top-left corner;(c, d)
is the bottom-right cornerPConstants.CENTER
:(a, b)
is the rectangle center;c
is width,d
is heightPConstants.RADIUS
:(a, b)
is the center;c
is half width,d
is half height
tl
– top-left corner radiustr
– top-right corner radiusbr
– bottom-right corner radiusbl
– bottom-left corner radius
- Parameters:
rectMode
- rectangle mode as in Processing; one ofPConstants.CORNER
,PConstants.CORNERS
,PConstants.CENTER
, orPConstants.RADIUS
a
- first coordinate: x (or center x, depending on mode)b
- second coordinate: y (or center y, depending on mode)c
- width, x2, or half-width (see mode above)d
- height, y2, or half-height (see mode above)r
- the uniform radius to be applied to all four corners- Returns:
- a
PShape
representing the rounded rectangle - Since:
- 2.1
-
createCircle
public static processing.core.PShape createCircle(processing.core.PVector c) Creates a geometric circle of radius r (.z) centered on (x,y).- Parameters:
c
- the PVector representing a circle- Since:
- 2.1
-
createCircle
public static processing.core.PShape createCircle(double x, double y, double r) Creates a circle of radius r centered on (x,y).- Since:
- 2.0
-