nodebox.graphics
Class AbstractGeometry

java.lang.Object
  extended by nodebox.graphics.AbstractTransformable
      extended by nodebox.graphics.AbstractGeometry
All Implemented Interfaces:
Cloneable, Drawable, Grob, IGeometry
Direct Known Subclasses:
Contour, Geometry, Path

public abstract class AbstractGeometry
extends AbstractTransformable
implements IGeometry


Field Summary
 
Fields inherited from interface nodebox.graphics.IGeometry
DEFAULT_POINT_AMOUNT
 
Constructor Summary
AbstractGeometry()
           
 
Method Summary
abstract  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.
 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.
abstract  AbstractGeometry mapPoints(com.google.common.base.Function<Point,Point> pointFunction)
          Change all points in the geometry and return a mutated copy.
abstract  Point pointAt(double t)
           
protected  double pointDelta(int amount, boolean closed)
          Calculate how far the points would be apart, given the specified amount and whether the geometry is closed.
 
Methods inherited from class nodebox.graphics.AbstractTransformable
getTransformDelegate, rotate, rotateRadians, scale, scale, setTransformDelegate, skew, skew, translate
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface nodebox.graphics.IGeometry
addPoint, addPoint, flatten, flattened, getPointCount, getPoints, makePoints, resampleByAmount, resampleByLength
 
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
 

Constructor Detail

AbstractGeometry

public AbstractGeometry()
Method Detail

extend

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

Specified by:
extend in interface IGeometry
Parameters:
points - the points to add to the geometry.

extend

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

Specified by:
extend in interface IGeometry
Parameters:
points - the points to add to the geometry.

makePoints

public 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.

Specified by:
makePoints in interface IGeometry
Returns:
a list of Points.

makePoints

public Point[] makePoints(int amount)
Description copied from interface: IGeometry
Make 100 new points along the contours of the existing path.

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

Specified by:
makePoints in interface IGeometry
Parameters:
amount - the amount of points to distribute.
Returns:
a list of Points.

pointDelta

protected double pointDelta(int amount,
                            boolean closed)
Calculate how far the points would be apart, given the specified amount and whether the geometry is closed.

Parameters:
amount - the amount of points
closed - whether the geometry is closed
Returns:
the delta value between each point

pointAt

public abstract Point pointAt(double t)

clone

public abstract IGeometry clone()
Description copied from interface: IGeometry
Clone the geometry, returning a new copy that is totally independent from the original.

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

mapPoints

public abstract AbstractGeometry mapPoints(com.google.common.base.Function<Point,Point> pointFunction)
Change all points in the geometry and return a mutated copy. The original geometry remains unchanged.

Parameters:
pointFunction - The function to apply to each point.
Returns:
The new geometry.


Copyright © 2013. All Rights Reserved.