com.jfimagine.jfgraph.geom
Class IsoscelesTriangle

java.lang.Object
  |
  +--com.jfimagine.jfgraph.geom.Rect
        |
        +--com.jfimagine.jfgraph.geom.IsoscelesTriangle
All Implemented Interfaces:
java.lang.Cloneable

public class IsoscelesTriangle
extends Rect

IsoscelesTriangle class. A class used to represent a isosceles triangle in the plane with double coordinates.

Attention: Here we used a clockwise quadrant system. And the first quadrant is under right bottom corner.

Version:
$Revision: 1.1 $
Author:
CookieMaker

Field Summary
static int TRIANGLESIDE_BOTTOM
          A const vertext type represents the bottom side of an isosceles triangle
static int TRIANGLESIDE_LEFT
          A const vertext type represents the left inclined side of an isosceles triangle
static int TRIANGLESIDE_RIGHT
          A const vertext type represents the right inclined side of an isosceles triangle
static int TRIANGLEVERTEX_LEFT
          A const vertext type represents the left vertex of an isosceles triangle
static int TRIANGLEVERTEX_RIGHT
          A const vertext type represents the right vertex of an isosceles triangle
static int TRIANGLEVERTEX_TOP
          A const vertext type represents the top vertex of an isosceles triangle
 
Fields inherited from class com.jfimagine.jfgraph.geom.Rect
m_leftBottom, m_leftTop, m_rightBottom, m_rightTop, SIDETYPE_BOTTOM, SIDETYPE_LEFT, SIDETYPE_RIGHT, SIDETYPE_TOP, VERTEXMOVETYPE_ISOSCELESTRAPEZOID, VERTEXMOVETYPE_PARALLEL, VERTEXMOVETYPE_RECTANGLE, VERTEXMOVETYPE_SCALE, VERTEXMOVETYPE_TRAPEZOID, VERTEXTYPE_LEFTBOTTOM, VERTEXTYPE_LEFTTOP, VERTEXTYPE_RIGHTBOTTOM, VERTEXTYPE_RIGHTTOP
 
Constructor Summary
IsoscelesTriangle()
          Constructor for IsoscelesTriangle.
IsoscelesTriangle(IsoscelesTriangle triangle)
          Constructor for IsoscelesTriangle.
 
Method Summary
 java.lang.Object clone()
          Creates a new object of the same class and with the same contents as this object.
 boolean contains(double x, double y)
          Test if a point(x, y coordinates for instead) is within this triangle.
 LineSeg getTriangleSide(int sideType)
          Get a side line of this triangle.
 JFPoint getTriangleVertex(int vertexType)
          Get a vertex of this triangle.
 boolean intersects(double x1, double y1, double x2, double y2)
          Tests if the specified line segment intersects the interior of this IsoscelesTriangle.
 boolean intersects(double x1, double y1, int pickOffset)
          Tests if the specified point intersects any side of this triangle.
 boolean intersects(LineSeg line)
          Tests if the specified line segment intersects the interior of this IsoscelesTriangle.
 boolean intersects(Rect rect)
          Tests if the specified rectangle intersects the interior of this IsoscelesTriangle.
 LineSeg pickLine(double x, double y, double pickOffset)
          Pick a line segment of this triangle by a point with a pickoffset.
 
Methods inherited from class com.jfimagine.jfgraph.geom.Rect
canAddPort, contains, equals, flipBy, flipBy, getBounds, getCenter, getHeight, getSide, getVertex, getWidth, getX, getY, hashCode, intersects, mirrorBy, mirrorBy, moveBy, moveVertex, newScaleCenter, rotateBy, rotateBy, rotateBy, scaleBy, scaleBy, setValue, setValue, setVertex, setVertex, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

TRIANGLEVERTEX_TOP

public static final int TRIANGLEVERTEX_TOP
A const vertext type represents the top vertex of an isosceles triangle

See Also:
Constant Field Values

TRIANGLEVERTEX_LEFT

public static final int TRIANGLEVERTEX_LEFT
A const vertext type represents the left vertex of an isosceles triangle

See Also:
Constant Field Values

TRIANGLEVERTEX_RIGHT

public static final int TRIANGLEVERTEX_RIGHT
A const vertext type represents the right vertex of an isosceles triangle

See Also:
Constant Field Values

TRIANGLESIDE_LEFT

public static final int TRIANGLESIDE_LEFT
A const vertext type represents the left inclined side of an isosceles triangle

See Also:
Constant Field Values

TRIANGLESIDE_RIGHT

public static final int TRIANGLESIDE_RIGHT
A const vertext type represents the right inclined side of an isosceles triangle

See Also:
Constant Field Values

TRIANGLESIDE_BOTTOM

public static final int TRIANGLESIDE_BOTTOM
A const vertext type represents the bottom side of an isosceles triangle

See Also:
Constant Field Values
Constructor Detail

IsoscelesTriangle

public IsoscelesTriangle()
Constructor for IsoscelesTriangle.


IsoscelesTriangle

public IsoscelesTriangle(IsoscelesTriangle triangle)
Constructor for IsoscelesTriangle.

Parameters:
triangle - A triangle object.
Method Detail

getTriangleVertex

public JFPoint getTriangleVertex(int vertexType)
Get a vertex of this triangle.

Parameters:
vertexType - A triangle vertex type.
Returns:
A triangle vertex.

getTriangleSide

public LineSeg getTriangleSide(int sideType)
Get a side line of this triangle.

Parameters:
sideType - A side type of this triangle.
Returns:
A side line.

contains

public boolean contains(double x,
                        double y)
Test if a point(x, y coordinates for instead) is within this triangle.

Overrides:
contains in class Rect
Parameters:
x - X coordinate of this point.
y - Y coordinate of this point.
Returns:
True if the point is inside this rectangle, false otherwise.

intersects

public boolean intersects(double x1,
                          double y1,
                          int pickOffset)
Tests if the specified point intersects any side of this triangle.

Overrides:
intersects in class Rect
Parameters:
pickOffset - An analog offset for 'pick' this line.
Returns:
true if the specified point intersects one side of this rectangle. false otherwise.

pickLine

public LineSeg pickLine(double x,
                        double y,
                        double pickOffset)
Pick a line segment of this triangle by a point with a pickoffset.

Overrides:
pickLine in class Rect
Parameters:
x - X coordinate of this point.
y - Y coordinate of this point.
pickOffset - An analog pick offset that great equal than 0.
Returns:
A line segment picked.

intersects

public boolean intersects(double x1,
                          double y1,
                          double x2,
                          double y2)
Tests if the specified line segment intersects the interior of this IsoscelesTriangle.

Overrides:
intersects in class Rect
Returns:
true if the specified line segment intersects the interior of this IsoscelesTriangle; false otherwise.

intersects

public boolean intersects(LineSeg line)
Tests if the specified line segment intersects the interior of this IsoscelesTriangle.

Overrides:
intersects in class Rect
Parameters:
line - the specified LineSeg to test for intersection with the interior of this IsoscelesTriangle
Returns:
true if the specified LineSeg intersects the interior of this IsoscelesTriangle; false otherwise.
Since:
1.2

intersects

public boolean intersects(Rect rect)
Tests if the specified rectangle intersects the interior of this IsoscelesTriangle.

Overrides:
intersects in class Rect
Parameters:
rect - the specified IsoscelesTriangle to test for intersection with the interior of this IsoscelesTriangle
Returns:
true if the specified IsoscelesTriangle intersects the interior of this IsoscelesTriangle; false otherwise.
Since:
1.2

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Creates a new object of the same class and with the same contents as this object.

Overrides:
clone in class Rect
Returns:
A clone of this instance.
java.lang.CloneNotSupportedException


Copyright 2004 ~ 2005 JingFei International Cooperation LTD. All Rights Reserved.