public class

Polygon

extends Element
java.lang.Object
   ↳ casmi.graphics.element.Element
     ↳ casmi.graphics.element.Polygon

Class Overview

Polygon class. Wrap JOGL and make it easy to use.

Summary

Constants
int LINES
int LINES_3D
int LINE_LOOP
[Expand]
Inherited Fields
From class casmi.graphics.element.Element
Public Constructors
Polygon()
Creates a new Polygon object.
Public Methods
int getNumberOfCorner()
Gets the number of corners.
Vector3D getVertex(int index)
Gets the corner of Polygon.
void removeVertex(int index)
Removes the corner of Polygon.
void render(GL2 gl, GLU glu, int width, int height, boolean selection)
void reset(GL2 gl)
void setCornerColor(int index, Color color)
Sets the color of a corner.
void setCornerColor(int index, ColorSet colorSet)
Sets the color of a corner.
void setPosition(double x, double y, double z)
Sets the position of the Element in 3D.
void setPosition(double x, double y)
Sets the position of the Element in 2D.
void setVertex(int i, double x, double y, double z)
Sets the coordinates of the corner.
void setVertex(int i, double x, double y)
Sets the coordinates of the corner.
void vertex(double x, double y)
Adds the corner of Polygon.
void vertex(double x, double y, double z)
Adds the corner of Polygon.
void vertex(Vector3D v)
Adds the corner of Polygon.
[Expand]
Inherited Methods
From class casmi.graphics.element.Element
From class java.lang.Object
From interface casmi.graphics.object.Renderable
From interface casmi.graphics.object.Resettable

Constants

public static final int LINES

Constant Value: 1 (0x00000001)

public static final int LINES_3D

Constant Value: 3 (0x00000003)

public static final int LINE_LOOP

Constant Value: 51 (0x00000033)

Public Constructors

public Polygon ()

Creates a new Polygon object.

Public Methods

public int getNumberOfCorner ()

Gets the number of corners.

Returns
  • The number of corners.

public Vector3D getVertex (int index)

Gets the corner of Polygon.

Parameters
index The index number of the corner.
Returns
  • The coordinates of the corner.

public void removeVertex (int index)

Removes the corner of Polygon.

Parameters
index The index number of the corner.

public void render (GL2 gl, GLU glu, int width, int height, boolean selection)

public void reset (GL2 gl)

public void setCornerColor (int index, Color color)

Sets the color of a corner.

Parameters
index The index number of a corner.
color The color of a corner.

public void setCornerColor (int index, ColorSet colorSet)

Sets the color of a corner.

Parameters
index The index number of a corner.
colorSet The colorSet of a corner.

public void setPosition (double x, double y, double z)

Sets the position of the Element in 3D.

Parameters
x x-coordinate
y y-coordinate
z z-coordinate

public void setPosition (double x, double y)

Sets the position of the Element in 2D.

Parameters
x x-coordinate
y y-coordinate

public void setVertex (int i, double x, double y, double z)

Sets the coordinates of the corner.

Parameters
i The index number of the point.
x The x-coordinate of the point.
y The y-coordinate of the point.
z The z-coordinate of the point.

public void setVertex (int i, double x, double y)

Sets the coordinates of the corner.

Parameters
i The index number of the point.
x The x-coordinate of the point.
y The y-coordinate of the point.

public void vertex (double x, double y)

Adds the corner of Polygon.

Parameters
x The x-coordinate of a new added corner.
y The y-coordinate of a new added corner.

public void vertex (double x, double y, double z)

Adds the corner of Polygon.

Parameters
x The x-coordinate of a new added corner.
y The y-coordinate of a new added corner.
z The z-coordinate of a new added corner.

public void vertex (Vector3D v)

Adds the corner of Polygon.

Parameters
v The coordinates of a new added corner.