sddl.hierarchy
Class Path

java.lang.Object
  extended by sddl.hierarchy.Shape
      extended by sddl.hierarchy.Path

public class Path
extends Shape

Describes a general path in space. A Path can be linear or curved and can have determined starting and ending tangent.

Version:
1.00
Author:
Mathieu Bourgeois

Constructor Summary
Path()
          Standard SDDL constructor
Path(java.util.LinkedList<AbstractPoint> list)
          Java-only constructor
Path(java.util.LinkedList<AbstractPoint> list, Point startingTangent, Point endingTangent)
          Java-only constructor with determined tangents
 
Method Summary
 void addPoint(AbstractPoint point)
          Adds a point at the end of the Path
 Path copy()
          Returns a copy of this Path
 void cycle()
          Forms a cycle with the Path by adding the first point at the end of the Path
 void draw(AbstractPoint location, java.io.PrintWriter out)
          Standard SDDL draw function.
 Point getEndingTangent()
          Gets the ending tangent of the Path, if there is one explicitly set
 int getNumberOfPoints()
          Returns the number of Points in the Path
 AbstractPoint getPoint(int i)
          Returns the Point at the position i
 java.util.LinkedList<AbstractPoint> getPoints()
          Returns a list of all points in the Path
 Point getStartingTangent()
          Gets the starting tangent of the Path, if there is one explicitly set
 boolean hasAEndingTangent()
          Verifies if the Path has an ending tangent
 boolean hasAStartingTangent()
          Verifies if the Path has a starting tangent
 boolean isLinear()
          Returns if a path is a linear one
 Path obtainPath()
          Returns itself
 java.lang.String pathValue()
          Returns an Asymptote string describing the Path
 void setEndingTangent(Point endingTangent)
          Sets the ending tangent of the Path
 void setLinear()
          Sets a Path to be linear
 void setStartingTangent(Point startingTangent)
          Sets the starting tangent of the Path
 Path translate(AbstractPoint translated)
          Translate a Path by translated
 
Methods inherited from class sddl.hierarchy.Shape
isVisible, setVisible
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Path

public Path()
Standard SDDL constructor


Path

public Path(java.util.LinkedList<AbstractPoint> list)
Java-only constructor

Parameters:
list - List of points in the Path

Path

public Path(java.util.LinkedList<AbstractPoint> list,
            Point startingTangent,
            Point endingTangent)
Java-only constructor with determined tangents

Parameters:
list - The list of points in the Path
startingTangent - Starting tangent of the Path
endingTangent - Ending tangent of the Path
Method Detail

copy

public Path copy()
Returns a copy of this Path

Specified by:
copy in class Shape
Returns:
A copy of this Path

addPoint

public void addPoint(AbstractPoint point)
Adds a point at the end of the Path

Parameters:
point - The point to add

setLinear

public void setLinear()
Sets a Path to be linear


isLinear

public boolean isLinear()
Returns if a path is a linear one

Returns:
If a path is a linear one

getPoint

public AbstractPoint getPoint(int i)
Returns the Point at the position i

Parameters:
i - The index of the point in the list (starting from 0)
Returns:
The point at the position i

getPoints

public java.util.LinkedList<AbstractPoint> getPoints()
Returns a list of all points in the Path

Returns:
A list of all points in the Path

getNumberOfPoints

public int getNumberOfPoints()
Returns the number of Points in the Path

Returns:
The number of Points in the Path

cycle

public void cycle()
Forms a cycle with the Path by adding the first point at the end of the Path


hasAStartingTangent

public boolean hasAStartingTangent()
Verifies if the Path has a starting tangent

Returns:
If the Path has a starting tangent

hasAEndingTangent

public boolean hasAEndingTangent()
Verifies if the Path has an ending tangent

Returns:
If the Path has an ending tangent

getStartingTangent

public Point getStartingTangent()
Gets the starting tangent of the Path, if there is one explicitly set

Returns:
The starting tangent of the Path

getEndingTangent

public Point getEndingTangent()
Gets the ending tangent of the Path, if there is one explicitly set

Returns:
The ending tangent of the Path

setStartingTangent

public void setStartingTangent(Point startingTangent)
Sets the starting tangent of the Path

Parameters:
startingTangent - The starting tangent of the Path

setEndingTangent

public void setEndingTangent(Point endingTangent)
Sets the ending tangent of the Path

Parameters:
endingTangent - The ending tangent of the Path

pathValue

public java.lang.String pathValue()
Returns an Asymptote string describing the Path

Returns:
An Asymptote string describing the Path

draw

public void draw(AbstractPoint location,
                 java.io.PrintWriter out)
Description copied from class: Shape
Standard SDDL draw function. Every shape must implement this

Specified by:
draw in class Shape
Parameters:
location - The location of the Shape on the main drawing
out - The file to be written to

obtainPath

public Path obtainPath()
Returns itself

Specified by:
obtainPath in class Shape
Returns:
self

translate

public Path translate(AbstractPoint translated)
Translate a Path by translated

Parameters:
translated - The translation to apply to the Path
Returns:
The translated resulting Path