| Modifier and Type | Field and Description |
|---|---|
protected processing.core.PApplet |
parent
The PApplet object for drawing thinks.
|
| Constructor and Description |
|---|
CurvedLens(processing.core.PApplet parent,
processing.core.PVector[] coordinates,
float height)
Builds a new CurvedLens shape with the given parameters.
|
| Modifier and Type | Method and Description |
|---|---|
int |
centerSize()
Returns the number of coordinates that defines this shape (points on
center curve).
|
float |
computeHeight(float tplusi)
Computes the thickness of the lens on a certain point in the shape.
|
void |
computeMinMax()
Forces to calculate the bounds of this shape and store them.
|
CurvedLens |
copy()
Builds and returns a true copy of this shape.
|
CurvedLens |
draw()
Draws the shape-
|
CurvedLens |
drawCenter()
Draws the center curve.
|
CurvedLens |
drawRaw()
Draws outline with lines not curves.
|
processing.core.PVector |
get(int i)
Returns the coordinate with index i.
|
float |
getArea()
Returns the area (approx).
|
Rect |
getBoundingBox()
Returns the bounding box of this shape (will mark the bounds of the
shape).
|
processing.core.PVector |
getCenter()
Returns the center coordinate of this shape.
|
processing.core.PVector[] |
getCoordinates()
Returns all coordinates that defines this shape.
|
Curve |
getCurve()
Returns the center curve.
|
int |
getDetails()
Returns the number of coordinates for the center curve.
|
float |
getDetailScale()
Returns the detailsScale factor.
|
processing.core.PVector |
getEnd()
Returns the end coordinate for this shape.
|
float |
getHeight()
Returns the thickness of this lens.
|
float |
getLength()
Returns the length (distance from start to end) of this shape.
|
LineSegments |
getLineSegments()
Returns the center LineSegments (raw version of the center curve).
|
java.lang.Float |
getRotation()
Returns the angle of shape.
|
processing.core.PVector |
getStart()
Returns the start coordinate for this shape.
|
java.lang.Float |
getX()
Returns the x-position of the start coordinate for this shape.
|
java.lang.Float |
getY()
Returns the y-position of the start coordinate for this shape.
|
CurvedLens |
rotate(float angle)
Turns the shape through the given angle.
|
CurvedLens |
rotate(processing.core.PVector rotationCenter,
float angle)
Turns the shape through the given angle.
|
CurvedLens |
scale(float scale)
Scale the shape by the given scaling factor.
|
CurvedLens |
scale(processing.core.PVector scaleCenter,
float scale)
Scale the shape by the given scaling factor.
|
CurvedLens |
scale(processing.core.PVector scaleCenter,
float scaleX,
float scaleY)
Scales the shape by the given scaling factors.
|
CurvedLens |
setDetails(int details)
Sets the number of coordinates for the center curve.
|
CurvedLens |
setDetailScale(float detailScale)
Sets the detailsScale factor.
|
CurvedLens |
setHeight(float height)
Sets the thickness of the lens.
|
CurvedLens |
setLength(float newLength)
Sets the length of this shape.
|
CurvedLens |
setLength(processing.core.PVector center,
float newLength)
Sets the length of this shape.
|
CurvedLens |
setLocation(float x,
float y)
Translates the shape to the given location.
|
CurvedLens |
setRotation(float angle)
Rotates the shape to the given angle (past rotations will be overridden).
|
CurvedLens |
setRotation(processing.core.PVector rotationCenter,
float angle)
Rotates the shape to the given angle (past rotations will be overridden).
|
CurvedLens |
setX(float x)
Translates the shape to the given x-location.
|
CurvedLens |
setY(float y)
Translates the shape to the given y-location.
|
int |
size()
Returns the number of coordinates for this shape.
|
Curve |
toCurve()
Returns the center curve.
|
LineSegments |
toLineSegments()
Returns the center LineSegments (raw version of the center curve).
|
Curve |
toSmoothedCurve()
Returns the a smoothend version of the center curve (smoothness depends
on detailScale).
|
CurvedLens |
translate(float x,
float y)
Translates the coordinates by the given parameters x, y ( "moves
the shape by x, y").
|
public CurvedLens(processing.core.PApplet parent,
processing.core.PVector[] coordinates,
float height)
parent - The PApplet object.coordinates - The coordinates of that describe the center curve for this
lens.height - The thickness of the lens.public float getDetailScale()
public int getDetails()
public int size()
RShape
for (int i = 0; i < myShape.size(); i++) {
PVector p = myShape.get(i);
}
public int centerSize()
public processing.core.PVector get(int i)
RShape
for (int i = 0; i < myShape.size(); i++) {
PVector p = myShape.get(i);
}
public processing.core.PVector getStart()
RShapepublic processing.core.PVector getEnd()
public Rect getBoundingBox()
RShapegetBoundingBox in interface RShapepublic processing.core.PVector getCenter()
RShapepublic java.lang.Float getX()
RShapepublic java.lang.Float getY()
RShapepublic float getHeight()
public float getLength()
public float getArea()
public processing.core.PVector[] getCoordinates()
RShapegetCoordinates in interface RShapepublic java.lang.Float getRotation()
RShapegetRotation in interface RShapepublic CurvedLens copy()
RShapepublic CurvedLens setLength(float newLength)
newLength - The new length of the line (> 0).public CurvedLens setLength(processing.core.PVector center, float newLength)
center - The control point for the scaling.newLength - The new length of the line (> 0).public CurvedLens setHeight(float height)
height - The thickness of the lens.public CurvedLens setRotation(float angle)
RShapesetRotation in interface RShapeangle - The target rotation angle.public CurvedLens setRotation(processing.core.PVector rotationCenter, float angle)
RShapesetRotation in interface RShaperotationCenter - The rotation center.angle - The target rotation angle.public CurvedLens setX(float x)
RShapepublic CurvedLens setY(float y)
RShapepublic CurvedLens setLocation(float x, float y)
RShapesetLocation in interface RShapex - The new x-position of this shape.y - The new y-position of this shape.public CurvedLens setDetailScale(float detailScale)
detailScale - The new detailScale (> 0).public CurvedLens setDetails(int details)
details - The number of coordinates for the curve (>= 2).public void computeMinMax()
public float computeHeight(float tplusi)
tplusi - A parameter that describes the position in the center curve. i
is the index of the coordinate, t is the parameter that
describes how near the returned normal is to that coordinate.
If t is 0 the normal will be directly at the coordinate, if t
is 1 the normal will be directly at the following coordinate.
For t=0.5 the normal will be in the middle of the coordinate
and the following coordinate. t and i should be summed for
this parameter, e.g. for the normal which is in the middle
(t=0.5) of coordinate[1] (i=1) and coordinate[2] tplusi should
be 1+0.5=0.5. i should be in range of [0, centerSize()).public CurvedLens translate(float x, float y)
RShapepublic CurvedLens rotate(float angle)
RShapepublic CurvedLens rotate(processing.core.PVector rotationCenter, float angle)
RShapepublic CurvedLens scale(float scale)
RShapepublic CurvedLens scale(processing.core.PVector scaleCenter, float scale)
RShapepublic CurvedLens scale(processing.core.PVector scaleCenter, float scaleX, float scaleY)
scaleCenter - The scaling center.scaleX - The horizontal scaling.scaleY - The vertical scaling.public CurvedLens draw()
RShapepublic CurvedLens drawRaw()
public CurvedLens drawCenter()
public Curve getCurve()
public Curve toCurve()
public LineSegments getLineSegments()
public LineSegments toLineSegments()
public Curve toSmoothedCurve()