com.threed.jpct
Class Polyline

java.lang.Object
  extended by com.threed.jpct.Polyline
All Implemented Interfaces:
java.io.Serializable

public class Polyline
extends java.lang.Object
implements java.io.Serializable

A Polyline is a line strip in world space. You can add a Polyline to a world and it will be rendered after all objects have been drawn.

See Also:
Serialized Form

Constructor Summary
Polyline(SimpleVector[] points, RGBColor color)
          Creates a new, static Polyline.
 
Method Summary
 RGBColor getColor()
          Returns the color of the line strip.
 int getLength()
          Returns the length of the line strip.
 Object3D getParent()
          Returns the parent object.
 float getPercentage()
          Returns the percentage (a value between 0 and 1 that defines how much of the line is actually visible).
 int getTransparencyMode()
          Returns the current transparency mode.
 float getWidth()
          Returns the line width.
 boolean isPointMode()
          Are we in point mode?
 boolean isVisible()
          Returns the visibility of the line.
 void setColor(RGBColor color)
          Sets the color of the line strip.
 void setParent(Object3D obj)
          Sets a parent object.
 void setPercentage(float percentage)
          Sets a value between 0 and 1 that defines how much of the line is actually visible. 0 means nothing, 1 means fully visible.
 void setPointMode(boolean pointMode)
          If set to true, points will be drawn instead of lines.
 void setTransparencyMode(int transparencyMode)
          Sets the transparency mode analog to the setter in Object3D (i.e. it uses the same constants).
 void setVisible(boolean visible)
          Sets the visibility of the line.
 void setWidth(float width)
          Sets the line width.
 void update(SimpleVector[] newPoints)
          Updates the line strip.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Polyline

public Polyline(SimpleVector[] points,
                RGBColor color)
Creates a new, static Polyline.

Parameters:
points - The coordinates in world space
color - The color
Method Detail

update

public void update(SimpleVector[] newPoints)
Updates the line strip. The new data has to be equal in size or smaller than the initial strip.

Parameters:
newPoints - the new points

getLength

public int getLength()
Returns the length of the line strip. This is the actual length * the value set as percentage.

Returns:
the length

setColor

public void setColor(RGBColor color)
Sets the color of the line strip.

Parameters:
color - the color

getColor

public RGBColor getColor()
Returns the color of the line strip.

Returns:
the color

setWidth

public void setWidth(float width)
Sets the line width. Default is 1.

Parameters:
width - the width

getWidth

public float getWidth()
Returns the line width. Default is 1.

Returns:
the width

setTransparencyMode

public void setTransparencyMode(int transparencyMode)
Sets the transparency mode analog to the setter in Object3D (i.e. it uses the same constants).

Parameters:
transparencyMode - the mode

getTransparencyMode

public int getTransparencyMode()
Returns the current transparency mode.

Returns:
the mode

setPercentage

public void setPercentage(float percentage)
Sets a value between 0 and 1 that defines how much of the line is actually visible. 0 means nothing, 1 means fully visible.

Parameters:
percentage - the percentage, 1 is default.

getPercentage

public float getPercentage()
Returns the percentage (a value between 0 and 1 that defines how much of the line is actually visible).

Returns:
the percentage

setVisible

public void setVisible(boolean visible)
Sets the visibility of the line.

Parameters:
visible - visible or not?

isVisible

public boolean isVisible()
Returns the visibility of the line.

Returns:
is it visible?

setPointMode

public void setPointMode(boolean pointMode)
If set to true, points will be drawn instead of lines.

Parameters:
pointMode - draw points? Default is false (which means lines).

isPointMode

public boolean isPointMode()
Are we in point mode?

Returns:
Are we?

setParent

public void setParent(Object3D obj)
Sets a parent object. The Polyline will inherit the transformation of this object. In this case, the Polyline behaves as it if has been defined in the object space of that object.

Parameters:
obj - the parent object

getParent

public Object3D getParent()
Returns the parent object.

Returns:
the parent object or null, if none has been set