Vault  4.1
Public Member Functions | Static Public Member Functions | Friends
VRectT< T > Class Template Reference

VRectT defines a rectangle. More...

#include <vgeometry.h>

List of all members.

Public Member Functions

 VRectT (const VPointT< T > &leftTop, const VSizeT< T > &size)
 VRectT (const VPointT< T > &leftTop, const VPointT< T > &rightBottom)
 VRectT (VBinaryIOStream &stream)
 VRectT (T left, T top, T width, T height)
void readFromStream (VBinaryIOStream &stream)
void writeToStream (VBinaryIOStream &stream) const
VPointT< T > getLeftTop () const
VPointT< T > getRightBottom () const
VPointT< T > getRightTop () const
VPointT< T > getLeftBottom () const
VSizeT< T > getSize () const
getLeft () const
getTop () const
getRight () const
getBottom () const
getWidth () const
getHeight () const
VPointT< T > getCenter () const
VLineT< T > getTopSide () const
 The "edge" functions return lines that are "normalized", preferring to point +x, then +y.
VLineT< T > getRightSide () const
VLineT< T > getBottomSide () const
VLineT< T > getLeftSide () const
VRectT< T > normalized () const
void moveTo (const VPointT< T > &leftTop)
void translate (T dx, T dy)
void translate (const VPointT< T > &offset)
void setSize (const VSizeT< T > &size)
void setWidth (T width)
void setHeight (T height)
void setBounds (T left, T top, T right, T bottom)
void setLeft (T left)
void setTop (T top)
void setRight (T right)
void setBottom (T bottom)
bool contains (const VPointT< T > &p) const
void expandTo (const VPointT< T > &p)
VRectT< T > united (const VRectT< T > &r) const
VRectT< T > intersected (const VRectT< T > &r) const
VPointT< T > getNearestVertex (const VPointT< T > &testPoint) const
 Returns the corner of the rectangle nearest to the supplied point.
VLineT< T > getNearestSide (const VPointT< T > &testPoint) const
 Returns the side of the rectangle that is nearest to the supplied point.
VLineT< T > getNearestSide (const VPointT< T > &testPoint, VPoint &nearestPoint) const
 Returns the side of the rectangle that is nearest to the supplied point.

Static Public Member Functions

static bool equal (const VRectT< T > &r1, const VRectT< T > &r2)
static bool notEqual (const VRectT< T > &r1, const VRectT< T > &r2)

Friends

bool operator== (const VRectT< T > &r1, const VRectT< T > &r2)
bool operator!= (const VRectT< T > &r1, const VRectT< T > &r2)

Detailed Description

template<typename T>
class VRectT< T >

VRectT defines a rectangle.

VRect uses VDouble coordinates; VIRect uses int coordinates.

Definition at line 506 of file vgeometry.h.


Member Function Documentation

template<typename T>
VLineT<T> VRectT< T >::getTopSide ( ) const [inline]

The "edge" functions return lines that are "normalized", preferring to point +x, then +y.

Definition at line 537 of file vgeometry.h.

template<typename T>
VPointT<T> VRectT< T >::getNearestVertex ( const VPointT< T > &  testPoint) const [inline]

Returns the corner of the rectangle nearest to the supplied point.

Parameters:
testPointa point to test proximity
Returns:
the corner nearest to the test point

Definition at line 635 of file vgeometry.h.

template<typename T>
VLineT<T> VRectT< T >::getNearestSide ( const VPointT< T > &  testPoint) const [inline]

Returns the side of the rectangle that is nearest to the supplied point.

If the test point is in a "dead zone" where the nearest point on a side is a vertex, there is currently no guarantee which of the two candidate sides will be returned.

Parameters:
testPointa point to test proximity
Returns:
a line defining a side of the rectangle the point is nearest to
See also:
"dead zone" comments at the end of this file

Definition at line 649 of file vgeometry.h.

template<typename T>
VLineT<T> VRectT< T >::getNearestSide ( const VPointT< T > &  testPoint,
VPoint nearestPoint 
) const [inline]

Returns the side of the rectangle that is nearest to the supplied point.

If the test point is in a "dead zone" where the nearest point on a side is a vertex, there is currently no guarantee which of the two candidate sides will be returned, and the returned nearestPoint will a vertex (shared by the two possible sides).

Parameters:
testPointa point to test proximity
nearestPointreturned value, the point (on the line segment) that is nearest to the test point
Returns:
a line defining a side of the rectangle the point is nearest to
See also:
"dead zone" comments at the end of this file

Definition at line 665 of file vgeometry.h.


The documentation for this class was generated from the following file:

Copyright ©1997-2014 Trygve Isaacson. All rights reserved. This documentation was generated with Doxygen.