nodebox.graphics
Interface IGeometry

All Superinterfaces:
Cloneable, Drawable, Grob
All Known Implementing Classes:
AbstractGeometry, Contour, Geometry, Path

public interface IGeometry
extends Grob


Field Summary
static int DEFAULT_POINT_AMOUNT
           
 
Method Summary
 void addPoint(double x, double y)
          Add a new point to the geometry specified by its x and y coordinates.
 void addPoint(Point pt)
          Add the given point to the geometry.
 IGeometry clone()
          Clone the geometry, returning a new copy that is totally independent from the original.
 void extend(Iterator<Point> points)
          Extend the current geometry with the given list of points.
 void extend(Point[] points)
          Extend the current geometry with the given list of points.
 void flatten()
          Flatten the geometry.
 IGeometry flattened()
          Make a flattened copy of the geometry.
 int getPointCount()
           
 List<Point> getPoints()
          Get the points for this geometry.
 Point[] makePoints()
          Make 100 new points along the contours of the existing path.
 Point[] makePoints(int amount)
          Make 100 new points along the contours of the existing path.
 Point[] makePoints(int amount, boolean perContour)
          Make new points along the contours of the existing path.
 IGeometry resampleByAmount(int amount, boolean perContour)
          Generate new geometry with the given amount of points along the shape of the original geometry.
 IGeometry resampleByLength(double segmentLength)
          Generate new geometry with points along the shape of the original geometry, spaced at the given length.
 
Methods inherited from interface nodebox.graphics.Grob
getBounds, getTransformDelegate, isEmpty, rotate, rotateRadians, scale, scale, setTransformDelegate, skew, skew, transform, translate
 
Methods inherited from interface nodebox.graphics.Drawable
draw
 

Field Detail

DEFAULT_POINT_AMOUNT

static final int DEFAULT_POINT_AMOUNT
See Also:
Constant Field Values
Method Detail

getPointCount

int getPointCount()

getPoints

List<Point> getPoints()
Get the points for this geometry.

This method returns live references to the points. Changing them will change the original geometry.

Returns:
a list of Points.

addPoint

void addPoint(Point pt)
Add the given point to the geometry. The point is cloned.

Parameters:
pt - the point to add.

addPoint

void addPoint(double x,
              double y)
Add a new point to the geometry specified by its x and y coordinates.

Parameters:
x - the X coordinate.
y - the Y coordinate.

extend

void extend(Iterator<Point> points)
Extend the current geometry with the given list of points.

Parameters:
points - the points to add to the geometry.

extend

void extend(Point[] points)
Extend the current geometry with the given list of points.

Parameters:
points - the points to add to the geometry.

makePoints

Point[] makePoints()
Make 100 new points along the contours of the existing path.

Points are evenly distributed according to the length of each geometric object.

Returns:
a list of Points.

makePoints

Point[] makePoints(int amount)
Make 100 new points along the contours of the existing path.

Points are evenly distributed according to the length of each geometric object.

Parameters:
amount - the amount of points to distribute.
Returns:
a list of Points.

makePoints

Point[] makePoints(int amount,
                   boolean perContour)
Make new points along the contours of the existing path.

Points are evenly distributed according to the length of each geometric object.

Parameters:
amount - the amount of points to distribute.
perContour - if true, the points are distributed per contour. The amount of points returned will then be number of contours * amount.
Returns:
a list of Points.

resampleByAmount

IGeometry resampleByAmount(int amount,
                           boolean perContour)
Generate new geometry with the given amount of points along the shape of the original geometry.

The length of each segment is not given and will be determined based on the required number of points.

Parameters:
amount - the number of points to generate.
perContour - whether the given points are per contour, or for the entire geometry.
Returns:
a new geometry object. This method will return whatever comes out of it, so calling resample on a Contour will return a new Contour object.

resampleByLength

IGeometry resampleByLength(double segmentLength)
Generate new geometry with points along the shape of the original geometry, spaced at the given length.

The number of points is not given and will be determined by the system based on the segment length.

Parameters:
segmentLength - the maximum length of each resampled segment.
Returns:
a new geometry object. This object will be of the same type as the callee, so calling resample on a Contour will return a new Contour object.

flatten

void flatten()
Flatten the geometry.


flattened

IGeometry flattened()
Make a flattened copy of the geometry.

Returns:
a flattened copy.

clone

IGeometry clone()
Clone the geometry, returning a new copy that is totally independent from the original.

Specified by:
clone in interface Grob
Returns:
the new geometry object.


Copyright © 2013. All Rights Reserved.