IGLine2D

IGLine2D provides a line segment defined by two end points. Line segments have an implied direction that move from the starting point to the end point.


IGLine2D - Member Functions and Data by Group

Constructors & Destructor

Use these functions to construct or destroy objects of class IGLine2D.


[view class]
~IGLine2D
public:
virtual ~IGLine2D()
Destroys the IGLine2D object.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
IGLine2D
Constructs a line segment.


Overload 1
Default constructor. The start and end points are initialized to IGPoint2D::kOrigin.
public:
IGLine2D()
Use this constructor to create a line segment whose start and end points are initialized to IGPoint2D::kOrigin.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 2
Constructor that takes two IGPoint2D objects as arguments.
public:
IGLine2D(IGPoint2D startPt, IGPoint2D endPt)
Use this constructor to create a 2D line segment object that uses the given values as its start and endpoints.

startPt
The starting point of the IGLine2D.
endPt
The end point of the IGLine2D.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 3
Copy constructor.
public:
IGLine2D(const IGLine2D&)
Use this constructor to create a 2D line segment object that is copied from the given one.

const IGLine2D&
The IGLine to be copied.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Assignment Operator

Use the operators in this group to perform simple or compound assignment operations.


[view class]
operator =
Assignment operator.
public:
IGLine2D& operator =(const IGLine2D& Src)
Assigns the given IGLine2D.

Src
The line whose value is copied.

Return
A non-const reference to the left-hand side object.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Modifying the Line

Use the functions in this group to transform the line or match a parametric position on the IGLine2D to a specified point.


[view class]
dragPosition
public:
void dragPosition(GParametric u, const IGPoint2D& toPoint)
Moves the IGLine2D so that the parametric position on the IGLine2D, specified by u, matches the point, specified by toPoint.

u
The parametric position on the IGLine2D.
toPoint
The point to match.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
transformBy
public:
void transformBy(const IGrafMatrix& transform)
Transforms the IGLine2D by the specified transformation.

transform
The transformation matrix to be applied to the IGLine2D.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Setting and Getting a Line's Start and End Points

Use the functions in this group to set or get a line's start point, its end point, or both.


[view class]
endPoint
public:
IGPoint2D endPoint() const
Returns the end point of the IGLine2D.

Return
An IGPoint2D representing the end point of the IGLine2D.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
points
public:
void points(IGPoint2D& startPt, IGPoint2D& endPt) const
Returns, in its arguments, both end points of the IGLine2D.

startPt
The starting point.
endPt
The end point.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
setEndPoint
public:
void setEndPoint(const IGPoint2D& point)
Sets the end point of the IGLine2D.

point
The new end point.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
setStartPoint
public:
void setStartPoint(const IGPoint2D& point)
Sets the starting point of the IGLine2D.

point
The new starting point.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
startPoint
public:
IGPoint2D startPoint() const
Returns the starting point of the IGLine2D.

Return
An IGPoint2D representing the starting point of the IGLine2D.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Streaming the Object In and Out

Use the functions and operators in this group to read the object from the data stream and write it to it.


[view class]
operator <<=
public:
IDataStream& operator <<=(IDataStream&)
Operator for streaming the object out to the polymorphic streaming specified by IDataStream.

IDataStream
A reference to the data stream to be used.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
operator >>=
public:
IDataStream& operator >>=(IDataStream&) const
Operator for streaming the object in using the polymorphic streaming specified by IDataStream.

IDataStream
A reference to the data stream.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
readFromStream
public:
void readFromStream(IDataStream& toWhere)
Streams in the line object using the polymorphic streaming specified by fromWhere.

Return
fromWhere The stream used to stream in the line object.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
writeToStream
public:
void writeToStream(IDataStream& toWhere) const
Streams the object out to the polymorphic streaming specified by toWhere.

toWhere
The stream for streaming out this image object.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Testing Aspects of the Line

Use the functions in this group to identify points on a line or determine if the line intersects a given rectangle.


[view class]
bounds
Returns the IGLine2D's bounding box.
public:
IGRect2D bounds() const
The bounding box is the smallest IGRect2D that encloses the line.

Return
An IGRect2D that bounds the line.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
evaluate
Returns a point corresponding to the given parameter.
public:
IGPoint2D evaluate(GParametric u) const
This function evaluates and returns the point. If the value is outside the range, the function returns an extrapolated point.

u
0 corresponds to the starting point, 1 to the end point.

Return
An IGPoint2D corresponding to the specified parameter.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
intersects
public:
bool intersects(const IGRect2D& g) const
Returns true if the IGLine2D intersects the specified rectangle.

g
The rectangle to be tested.

Return
True if the IGLine2D intersects the rectangle.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
nearestParametric
Finds the parametric value corresponding to the point on the IGLine2D that is nearest to the specified point.
public:
GParametric nearestParametric(const IGPoint2D& test) const
This function returns a value that is clamped between 0 and 1.

test
The point whose parametric value is to be found.

Return
A GParametric that best matches the specified point.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Testing for Equality or Inequality

Use these functions for equality or inequality testing.


[view class]
operator !=
public:
bool operator !=(const IGLine2D& Src) const
Tests two IGLine2D objects for inequality.

Src
The line to be compared to the current line.

Return
True if the starting or end points of both lines are not equal.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
operator ==
public:
bool operator ==(const IGLine2D& Src) const
Tests two IGLine2D objects for equality.

Src
The line to be compared to this line.

Return
True if the starting and end points of both lines are equal.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


IGLine2D - Inherited Member Functions and Data

Inherited Public Functions

Inherited Public Data

Inherited Protected Functions

Inherited Protected Data