Point2D Class Reference

A standard two dimensional Point/Vector class. More...

#include </usr1/tp517/Tumble/trunk/src/tumble/util.h>

List of all members.

Public Member Functions

 Point2D ()
 Point2D (double x, double y)
 Point2D (const Point2D &o)
Point2Dassign (double x, double y)
double operator[] (int i) const
double x () const
double y () const
bool operator< (const Point2D &o) const
bool operator<= (const Point2D &o) const
bool operator> (const Point2D &o) const
bool operator>= (const Point2D &o) const
Point2Doperator= (const Point2D &o)
 Assignment operator.
Point2Doperator+= (const Point2D &o)
Point2Doperator-= (const Point2D &o)
Point2Doperator *= (double s)
Point2Doperator/= (double s)
Point2D operator+ (const Point2D &o) const
Point2D operator- (const Point2D &o) const
Point2D operator * (double s) const
Point2D operator/ (double s) const
double dot (const Point2D &o) const
double magsq () const
double mag () const
double cross (const Point2D &a) const
 Determinate-like operation.
bool machine_equal (const Point2D &other) const
 Tests if this point is exactly, to machine accuracy, the same as b.
bool is_left_of (const Point2D &a, const Point2D &b) const
 Tests if this point is left of line given by a and b.
bool is_right_of (const Point2D &a, const Point2D &b) const
 Tests if this point is right of line given by a and b.
double line_side_test (Point2D a, Point2D b) const
 Tests which side of line given by a and b that this point is on.
bool in_circle_test (Point2D a, Point2D b, Point2D c) const
 Tests if this point is in the circle defined by a , b , and c.
double dist_from_line (const Point2D &a, const Point2D &b) const
 Gives distance of this point from the line defined by a and b.
double angle (const Point2D &a, const Point2D &c) const
 Return the cosine of the angle made by the triple (a, this, c).
void print ()

Public Attributes

double coords [2]
 The coodinates of the point.

Friends

std::ostream & operator<< (std::ostream &, const Point2D &p)


Detailed Description

A standard two dimensional Point/Vector class.

Geometric data on the mesh is of type Point2D

Definition at line 46 of file util.h.


Constructor & Destructor Documentation

Point2D::Point2D (  )  [inline]

Definition at line 51 of file util.h.

References coords.

Referenced by operator *(), operator+(), operator-(), and operator/().

Point2D::Point2D ( double  x,
double  y 
) [inline]

Definition at line 57 of file util.h.

References coords.

Point2D::Point2D ( const Point2D o  )  [inline]

Definition at line 63 of file util.h.

References coords.


Member Function Documentation

Point2D& Point2D::assign ( double  x,
double  y 
) [inline]

Definition at line 70 of file util.h.

References coords.

Referenced by MeshConstructor::add_arc(), MeshConstructor::add_circle(), MeshConstructor::add_spiral(), Visualization::compute_world_size(), Visualization::draw_circle(), Visualization::project(), and EPSWrite::project_to_canvas().

double Point2D::operator[] ( int  i  )  const [inline]

Definition at line 77 of file util.h.

References coords.

double Point2D::x (  )  const [inline]

Definition at line 78 of file util.h.

References coords.

Referenced by MeshConstructor::add_spiral(), Vec3D::assign(), Visualization::compute_world_size(), EPSWrite::convert_coords(), Visualization::convert_from_screen_coords(), Visualization::draw_circle(), EPSWrite::EPSWrite(), Visualization::get_bbox(), Visualization::is_visible(), BezierMesh::locate_point_in_linear_mesh(), machine_equal(), QBSpline::move(), Simulation::move_(), GhostTriangle::print_mathematica(), BezierTriangle::print_mathematica(), Visualization::project(), EPSWrite::project_to_canvas(), EPSWrite::set_world_view(), BezierMesh::should_refine_func_angle(), BezierMesh::smooth_point(), Vec3D::Vec3D(), and Visualization::zoomin().

double Point2D::y (  )  const [inline]

Definition at line 79 of file util.h.

References coords.

Referenced by Vec3D::assign(), Visualization::compute_world_size(), EPSWrite::convert_coords(), Visualization::convert_from_screen_coords(), Visualization::draw_circle(), EPSWrite::EPSWrite(), Visualization::get_bbox(), Visualization::is_visible(), BezierMesh::locate_point_in_linear_mesh(), machine_equal(), QBSpline::move(), Simulation::move_(), GhostTriangle::print_mathematica(), BezierTriangle::print_mathematica(), Visualization::project(), EPSWrite::project_to_canvas(), EPSWrite::set_world_view(), BezierMesh::smooth_point(), Vec3D::Vec3D(), and Visualization::zoomin().

bool Point2D::operator< ( const Point2D o  )  const [inline]

Definition at line 81 of file util.h.

References magsq().

Here is the call graph for this function:

bool Point2D::operator<= ( const Point2D o  )  const [inline]

Definition at line 86 of file util.h.

References magsq().

Here is the call graph for this function:

bool Point2D::operator> ( const Point2D o  )  const [inline]

Definition at line 91 of file util.h.

References magsq().

Here is the call graph for this function:

bool Point2D::operator>= ( const Point2D o  )  const [inline]

Definition at line 96 of file util.h.

References magsq().

Here is the call graph for this function:

Point2D& Point2D::operator= ( const Point2D o  )  [inline]

Assignment operator.

Definition at line 102 of file util.h.

References coords.

Point2D& Point2D::operator+= ( const Point2D o  )  [inline]

Definition at line 110 of file util.h.

References coords.

Point2D& Point2D::operator-= ( const Point2D o  )  [inline]

Definition at line 117 of file util.h.

References coords.

Point2D& Point2D::operator *= ( double  s  )  [inline]

Definition at line 124 of file util.h.

References coords.

Point2D& Point2D::operator/= ( double  s  )  [inline]

Definition at line 131 of file util.h.

References coords.

Point2D Point2D::operator+ ( const Point2D o  )  const [inline]

Definition at line 139 of file util.h.

References coords, and Point2D().

Here is the call graph for this function:

Point2D Point2D::operator- ( const Point2D o  )  const [inline]

Definition at line 144 of file util.h.

References coords, and Point2D().

Here is the call graph for this function:

Point2D Point2D::operator * ( double  s  )  const [inline]

Definition at line 149 of file util.h.

References coords, and Point2D().

Here is the call graph for this function:

Point2D Point2D::operator/ ( double  s  )  const [inline]

Definition at line 154 of file util.h.

References coords, and Point2D().

Here is the call graph for this function:

double Point2D::dot ( const Point2D o  )  const [inline]

Definition at line 160 of file util.h.

References coords.

Referenced by angle(), BezierEdge::curvature_angle(), and dist_from_line().

double Point2D::magsq (  )  const [inline]

Definition at line 165 of file util.h.

References coords.

Referenced by CurvedTriangle::newton_find(), operator<(), operator<=(), operator>(), and operator>=().

double Point2D::mag (  )  const [inline]

Definition at line 170 of file util.h.

References coords.

Referenced by angle(), BezierEdge::curvature_angle(), dist_from_line(), and BezierTriangle::offcenter().

double Point2D::cross ( const Point2D a  )  const [inline]

Determinate-like operation.

Definition at line 176 of file util.h.

References coords.

Referenced by GhostTriangle::jacobian(), BezierTriangle::jacobian(), and CurvedTriangle::newton_find().

bool Point2D::machine_equal ( const Point2D other  )  const [inline]

Tests if this point is exactly, to machine accuracy, the same as b.

We don't define operator== because that's dangerous with floating point: only use this if you know what you're doing.

Definition at line 189 of file util.h.

References x(), and y().

Referenced by BezierMesh::locate_point_in_linear_mesh().

Here is the call graph for this function:

bool Point2D::is_left_of ( const Point2D a,
const Point2D b 
) const [inline]

Tests if this point is left of line given by a and b.

Uses exact arithmetic predicates of Shewchuk, from libgeopredicates.so

Parameters:
a First point of line
b Second point of line
Returns:
true if this point is left of line

Definition at line 201 of file util.h.

References line_side_test().

Referenced by BezierMesh::can_flip(), in_circle_test(), BezierTriangle::is_linear_inverted(), BezierEdge::left_of_curve(), and point_in_poly_kernel().

Here is the call graph for this function:

bool Point2D::is_right_of ( const Point2D a,
const Point2D b 
) const [inline]

Tests if this point is right of line given by a and b.

Uses exact arithmetic predicates of Shewchuk, from libgeopredicates.so

Parameters:
a First point of line
b Second point of line
Returns:
true if this point is right of line

Definition at line 211 of file util.h.

References line_side_test().

Here is the call graph for this function:

double Point2D::line_side_test ( Point2D  a,
Point2D  b 
) const

Tests which side of line given by a and b that this point is on.

Uses exact arithmetic predicates of Shewchuk, from libgeopredicates.so

Parameters:
a First point of line
b Second point of line
Returns:
Positive if this point is right of line, negative if left of line, and 0 if co-linear

Definition at line 47 of file util.C.

References coords.

Referenced by ConformalMesher::angle_is_positive(), is_left_of(), is_right_of(), and BezierMesh::locate_point_in_linear_mesh().

bool Point2D::in_circle_test ( Point2D  a,
Point2D  b,
Point2D  c 
) const

Tests if this point is in the circle defined by a , b , and c.

Uses exact arithmetic predicates of Shewchuk, from libgeopredicates.so

Parameters:
a First point of circle
b Second point of circle
c Third point of circle
Returns:
true if this point is in the circle

Definition at line 55 of file util.C.

References coords, and is_left_of().

Referenced by _wrap_Point2D_in_circle_test(), and BezierMesh::should_flip().

Here is the call graph for this function:

double Point2D::dist_from_line ( const Point2D a,
const Point2D b 
) const

Gives distance of this point from the line defined by a and b.

Definition at line 69 of file util.C.

References dot(), and mag().

Here is the call graph for this function:

double Point2D::angle ( const Point2D a,
const Point2D c 
) const [inline]

Return the cosine of the angle made by the triple (a, this, c).

Return the cosine of the angle made by the intersection of the lines formed by (a, this) and (c, this).

Parameters:
a The first point
c The second point
Returns:
The cosine of the angle

Definition at line 246 of file util.h.

References dot(), and mag().

Referenced by BezierTriangle::small_angle().

Here is the call graph for this function:

void Point2D::print (  )  [inline]

Definition at line 254 of file util.h.


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  ,
const Point2D p 
) [friend]


Member Data Documentation

double Point2D::coords[2]

The coodinates of the point.

Definition at line 48 of file util.h.

Referenced by MeshConstructor::add_spiral(), assign(), BoundaryMesh::bbox(), compute_displacement(), Visualization::compute_world_size(), Visualization::convert_from_screen_coords(), cross(), dot(), Visualization::draw_bezier_edge(), Visualization::draw_bezier_triangle(), Visualization::draw_bezier_vertex(), Visualization::draw_boundary_edge(), Visualization::draw_boundary_edge_debug(), Visualization::draw_circle(), Visualization::draw_control_net(), Visualization::draw_newton(), Visualization::draw_point(), EPSWrite::EPSWrite(), Visualization::get_bbox(), in_circle_test(), line_side_test(), mag(), magsq(), MeshInput::Node::Node(), operator *(), operator *=(), operator+(), operator+=(), operator-(), operator-=(), operator/(), operator/=(), operator<<(), operator=(), operator[](), Point2D(), Visualization::project(), EPSWrite::project_to_canvas(), MeshInput::read_boundary_edge_data(), BezierMesh::smooth_point(), x(), y(), and Visualization::zoomin().


The documentation for this class was generated from the following files:
Generated on Mon May 24 09:53:34 2010 for TUMBLE by  doxygen 1.5.2