|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.hedgehog.HObject
com.hedgehog.geo.GeometricObject
com.hedgehog.geo.twod.GeometricObject2D
com.hedgehog.geo.twod.curves.Curve2D
com.hedgehog.geo.twod.curves.StraightLine2D
public class StraightLine2D
Title: StraightLine2D - represents a straight line segment of finite length.
Description: Models a 2D straight line segment of finite length and terminated by two end-points.
Copyright: Copyright (c) Hedgehog Software 2007-2009.
Company: Hedgehog Software
| Field Summary |
|---|
| Fields inherited from class com.hedgehog.geo.twod.curves.Curve2D |
|---|
mp0, mp1 |
| Fields inherited from class com.hedgehog.HObject |
|---|
mID, mName |
| Constructor Summary | |
|---|---|
StraightLine2D()
Default constructor. |
|
StraightLine2D(ID id)
Constructor. |
|
StraightLine2D(Point2D p0,
Point2D p1)
Constructor. |
|
StraightLine2D(Point2D p0,
Point2D p1,
java.lang.String name,
ID id)
Constructor. |
|
StraightLine2D(StraightLine2D object)
Copy constructor. |
|
StraightLine2D(java.lang.String name)
Constructor. |
|
StraightLine2D(java.lang.String name,
ID id)
Constructor. |
|
| Method Summary | |
|---|---|
java.util.Vector<ModelObject> |
childModelObjects()
Returns a vector of this object's child ModelObject objects. |
java.sql.PreparedStatement |
databaseInsertStatement(java.sql.Connection connection,
int modelID)
Returns a prepared statement for inserting (INSERT command) a ModelObject object into a database. |
java.sql.PreparedStatement |
databaseUpdateStatement(java.sql.Connection connection,
int modelID)
Returns a prepared statement for updating (UPDATE command) a ModelObject object into a database. |
double |
ellipticDistance(Point2D p)
Returns the distance (bc+ca) of a point at c to line ab. |
Point2D |
extrapolatedPoint(double c1,
double c2)
Returns an extrapolated point which divides a straight line in the ratio p0-p:p-p1 is c1:c2. |
ModelObject |
fromDatabase(java.sql.Connection connection,
Model model,
int modelID,
int objectID)
Returns a model object from the specified database table. |
ModelObject |
fromXMLNode(org.w3c.dom.Document document,
org.w3c.dom.Node documentRootNode,
org.w3c.dom.Node node,
Model model)
Returns a model object from the specified xml node. |
double |
interpolation(double p0_value,
double p1_value,
double u)
Returns the interpolated value at the parametric point u from the end-point values p0_value and p1_value. |
Intersection2D |
intersection(Ray2D ray,
double tolerance)
Intersects the specified ray with this straight-line. |
Intersection2D |
intersection(StraightLine2D line,
double tolerance)
Intersects the specified straight-line with this straight-line. |
java.util.Vector<Point2D> |
intersectionPoints(StraightLine2D line,
double tolerance)
Tests whether or not the specified line intersects with this line and returns the vector of intersection points, if any. |
boolean |
isHorizontal(double tolerance)
Tests whether or not this line segment is horizontal. |
boolean |
isOrthogonal(StraightLine2D l,
double tolerance)
Returns logical-true if two lines are orthogonal/perpendicular. |
boolean |
isValid(double tolerance)
Tests whether or not this line is valid. |
boolean |
isVertical(double tolerance)
Tests whether or not this line segment is vertical. |
double |
length()
Returns the length of this straight line. |
Point2D |
maximumPointFromGloablOrigin()
Returns the furthest end-point with respect to the global origin. |
double |
maximumX(double tolerance)
Returns the maximum x-value of this curve. |
double |
maximumY(double tolerance)
Returns the minimum y-value of this curve. |
Point2D |
midPoint()
Returns the mid-point of this line. |
double |
minimumDistance(Point2D p,
double tolerance)
Returns the minimum distance (i.e. |
Point2D |
minimumPointFromGloablOrigin()
Returns the closet end-point with respect to the global origin. |
double |
minimumX(double tolerance)
Returns the minimum x-value of this curve. |
double |
minimumY(double tolerance)
Returns the minimum y-value of this curve. |
Point2D |
nearestEndPoint(Point2D p,
double tolerance)
Returns the nearest end-point to the specified point, p. |
double |
parametricVariable(Point2D p,
double tolerance)
Returns the value of the parametric variable, u, corresponding to the specified point. |
InfiniteStraightLine2D |
perpendicularStraightLineThroughPoint(Point2D p,
double tolerance)
Returns an infinite straight-line which is perpendicular to the operated-on straight-line and passes through point p. |
Point2D |
pointOnCurve(double u,
double tolerance)
Returns a point on a straight-line which corresponds to the specified parametric variable, u. |
boolean |
pointOnCurve(Point2D p,
double tolerance)
Tests whether or not the specified point is on this curve. |
boolean |
pointOnLeft(Point2D p,
double tolerance)
Tests whether or not the specified point is on the lhs of this line, with the line's sense from p0 to p1. |
boolean |
pointOnRight(Point2D p,
double tolerance)
Tests whether or not the specified point is on the lhs of this line, with the line's sense from p0 to p1. |
boolean |
pointsOnSameSide(Point2D p,
Point2D q)
Tests whether or not the specified points are on the same side of this line. |
Vector2D |
tangent()
Returns the tangent vector of this straight line from p0 to p1. |
Vector2D |
tangent(double u)
Returns the tangent vector at point u. |
Vector2D |
tangent(Point2D p)
Returns the tangent vector at point u. |
InfiniteStraightLine2D |
toInfiniteStraightLine2D()
Returns the InfiniteStraightLine2D object passing through the two points of this line. |
LinearLine2D |
toLinearLine2D()
Returns the infinite LinearLine2D object passing through the two points of this line. |
Ray2D |
toRay2D()
Returns the Ray2D object with p0 as origin and vector [p0-->p1] as direction. |
X3DNode |
toX3DNode(X3DObject x3dObject)
X3D support. |
org.w3c.dom.Element |
toXMLNode(org.w3c.dom.Document document,
org.w3c.dom.Element documentRootNode)
Returns the xml node of this object. |
| Methods inherited from class com.hedgehog.geo.GeometricObject |
|---|
objectDimension |
| Methods inherited from class com.hedgehog.HObject |
|---|
clone, compare, compareTo, copy, getID, getName, hashCode, hasID, hasName, setID, setName |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public StraightLine2D()
public StraightLine2D(Point2D p0,
Point2D p1)
p0 - End-point p0.p1 - End-point p1.
public StraightLine2D(Point2D p0,
Point2D p1,
java.lang.String name,
ID id)
p0 - End-point p0.p1 - End-point p1.name - Straight-line name.id - Straight-line ID.public StraightLine2D(java.lang.String name)
name - Straight-line name.public StraightLine2D(ID id)
id - Straight-line ID.
public StraightLine2D(java.lang.String name,
ID id)
name - Straight-line name.id - Straight-line ID.public StraightLine2D(StraightLine2D object)
object - Object to copy.| Method Detail |
|---|
public double length()
length in class Curve2Dpublic Point2D midPoint()
midPoint in class Curve2D
public boolean pointsOnSameSide(Point2D p,
Point2D q)
p - Point 1.q - Point 2.
public double parametricVariable(Point2D p,
double tolerance)
throws java.lang.IllegalArgumentException
parametricVariable in class Curve2Dp - Point to determine parametric variable value.tolerance - Required tolerance.
java.lang.IllegalArgumentException - Thrown if p is not on the operated-on straight-line.
public InfiniteStraightLine2D perpendicularStraightLineThroughPoint(Point2D p,
double tolerance)
p - Point from which to form straight-line that is perpendicular to this straight-line.tolerance - Required tolerance.
public Point2D pointOnCurve(double u,
double tolerance)
throws java.lang.IllegalArgumentException
pointOnCurve in class Curve2Du - Parametric variable value.tolerance - Required tolerance.
java.lang.IllegalArgumentException - Thrown if u is out of range [0:1].
public boolean pointOnCurve(Point2D p,
double tolerance)
pointOnCurve in class Curve2Dp - Point to test.tolerance - Required tolerance.
public boolean pointOnLeft(Point2D p,
double tolerance)
pointOnLeft in class Curve2Dp - point to test.tolerance - Required tolerance.
public boolean pointOnRight(Point2D p,
double tolerance)
pointOnRight in class Curve2Dp - point to test.tolerance - Required tolerance.
public java.util.Vector<Point2D> intersectionPoints(StraightLine2D line,
double tolerance)
throws java.lang.IllegalArgumentException
line - Line to test for intersection with this line.tolerance - Required tolerance.
java.lang.IllegalArgumentException - Thrown if line is null.
public Intersection2D intersection(StraightLine2D line,
double tolerance)
line - Straight line to test.tolerance - Required tolerance.
java.lang.IllegalArgumentException - Thrown if line is null.
public Intersection2D intersection(Ray2D ray,
double tolerance)
throws java.lang.IllegalArgumentException
ray - Ray.tolerance - Required tolerance.
java.lang.IllegalArgumentException - Thrown if ray is null.
public double minimumX(double tolerance)
throws FunctionEvaluationException
minimumX in class Curve2Dtolerance - Required tolerance.
FunctionEvaluationException - Not thrown.
public double minimumY(double tolerance)
throws FunctionEvaluationException
minimumY in class Curve2Dtolerance - Required tolerance.
FunctionEvaluationException - Not thrown.
public double maximumX(double tolerance)
throws FunctionEvaluationException
maximumX in class Curve2Dtolerance - Required tolerance.
FunctionEvaluationException - Not thrown.
public double maximumY(double tolerance)
throws FunctionEvaluationException
maximumY in class Curve2Dtolerance - Required tolerance.
FunctionEvaluationException - Not thrown.public Point2D minimumPointFromGloablOrigin()
public Point2D maximumPointFromGloablOrigin()
public double minimumDistance(Point2D p,
double tolerance)
minimumDistance in class Curve2Dp - Point from which to determine the minimum distance between and dthis curve.tolerance - Required tolerance.
public Point2D nearestEndPoint(Point2D p,
double tolerance)
throws java.lang.IllegalArgumentException
p - Point to test.tolerance - Required tolerance used for testing p lies on this curve.
java.lang.IllegalArgumentException - Thrown if p is null.public double ellipticDistance(Point2D p)
p - Point to fidn elliptic distance.
public Point2D extrapolatedPoint(double c1,
double c2)
throws java.lang.IllegalArgumentException
c1 - Length ratio p0-p.c2 - Length ratio p-p1.
java.lang.IllegalArgumentException - Thrown if c1 and c2 are equivalent.
public double interpolation(double p0_value,
double p1_value,
double u)
throws java.lang.IllegalArgumentException
p0_value - Value at p0.p1_value - Value at p1.u - Parametric coordinate along line.
java.lang.IllegalArgumentException - Thrown if u out of range [0:1].
public boolean isOrthogonal(StraightLine2D l,
double tolerance)
l - Line to test against this line.tolerance - Required tolerance.
public boolean isHorizontal(double tolerance)
tolerance - Required tolerance.
public boolean isVertical(double tolerance)
tolerance - Required tolerance.
public boolean isValid(double tolerance)
tolerance - Required tolerance.
public Vector2D tangent(double u)
throws java.lang.IllegalArgumentException
tangent in class Curve2Du - Parametric variable u.
java.lang.IllegalArgumentException - Throws exception if u is outside the range [0:1].
public Vector2D tangent(Point2D p)
throws java.lang.IllegalArgumentException
tangent in class Curve2Dp - Parametric variable u.
java.lang.IllegalArgumentException - Throws exception if u is outside the range [0:1].public Vector2D tangent()
public LinearLine2D toLinearLine2D()
public InfiniteStraightLine2D toInfiniteStraightLine2D()
public Ray2D toRay2D()
public java.util.Vector<ModelObject> childModelObjects()
childModelObjects in interface ModelObject
public java.sql.PreparedStatement databaseInsertStatement(java.sql.Connection connection,
int modelID)
throws java.sql.SQLException
databaseInsertStatement in interface ModelObjectconnection - Database connection.modelID - Model ID.
java.sql.SQLException - Thrown if an SQL exception occurs.
public java.sql.PreparedStatement databaseUpdateStatement(java.sql.Connection connection,
int modelID)
throws java.sql.SQLException
databaseUpdateStatement in interface ModelObjectconnection - Database connection.modelID - Model ID.
java.sql.SQLException - Thrown if an SQL exception occurs.
public org.w3c.dom.Element toXMLNode(org.w3c.dom.Document document,
org.w3c.dom.Element documentRootNode)
throws InvalidObjectException
toXMLNode in interface ModelObjectdocument - XML document.documentRootNode - Document root node.
InvalidObjectException - Thrown if this object's ID is equal to the default ID of -1.
public ModelObject fromXMLNode(org.w3c.dom.Document document,
org.w3c.dom.Node documentRootNode,
org.w3c.dom.Node node,
Model model)
throws InvalidObjectException
fromXMLNode in interface ModelObjectdocument - XML document.documentRootNode - Document root node; ie Model node.node - XML node.model - The model to which this object is added.
InvalidObjectException - Thrown if an error occurred building the object.
public ModelObject fromDatabase(java.sql.Connection connection,
Model model,
int modelID,
int objectID)
throws java.sql.SQLException
fromDatabase in interface ModelObjectconnection - Database connection.modelID - Model ID.objectID - Object ID in associated ModelObjects table.model - Model built from database.
java.sql.SQLException - Thrown if an SQL exception occurs.
public X3DNode toX3DNode(X3DObject x3dObject)
throws InvalidObjectException
toX3DNode in interface ModelObjectx3dObject - X3D object.
InvalidObjectException - Thrown if this object is invalid.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||