BezierEdge Class Reference

The Edge type for BezierMesh. More...

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

Inheritance diagram for BezierEdge:

[legend]
Collaboration diagram for BezierEdge:
[legend]
List of all members.

Public Types

typedef EdgeCell super

Public Member Functions

 BezierEdge (PersistantStore &, BezierVertex *v1, BezierVertex *v2, const ControlPoint &, const DataStore &)
 Create an empty BezierEdge.
virtual ~BezierEdge ()
void set_bdry (BoundaryEdge *be, double u0, double u1)
 Destructor.
void set_cp (const Point2D &p, int i)
 Set the value of ControlPoint with given index.
void set_dp (const LinearData &d, int i)
 Set the value of DataPoint with given index.
void set_data (int i, int pos, double data)
 Set the value of DataPoint with given index, at the given position.
int get_num_cp () const
const Point2Dget_cp (int i) const
 Get the value of ControlPoint with given index.
Point2Daccess_cp (int i)
 Get read-write access to the point at position i.
ControlPoint get_control_point (int i) const
 Direct access to the ControlPoint pointer.
const LinearDataget_dp (int i) const
 Get the value of DataPoint with given index.
LinearDataaccess_dp (int i)
 Get the value of DataPoint with given index.
DataPoint get_data_point (int i) const
 Direct access to the DataPoint pointer.
const BezierVertexget_vertex (int i) const
 Get the BezierVertex that is a sub-cell of this edge, with given index.
BezierVertexget_vertex (int i)
bool is_boundary () const
 True if this is a boundary edge.
const BoundaryEdgeget_bdry_edge () const
BoundaryEdgeget_bdry_edge ()
double get_u (int i) const
Point2D eval (double u) const
 Given a parameter in [0,1], interpolate the geometric coordinates in the Bezier Basis.
LinearData dataeval (double u) const
 Given a parameter in [0,1], interpolate the functional value in the Bezier Basis.
void evalIntermediate (double u, Point2D &p, Point2D &pc0, Point2D &pc1) const
 Given a parameter in [0,1], interpolate the geometric coordinates in the Bezier Basis.
void dataevalIntermediate (double u, LinearData &d, LinearData &dc0, LinearData &dc1) const
 Given a parameter in [0,1], interpolate the functional data in the Bezier Basis.
bool is_encroached (const Point2D &) const
 Determines id the given point encroaches this edge.
int left_of_curve (Point2D &, int, double &) const
 Determines if the point is left of the curve.
double curvature_angle () const
 Returns the total turning (theta) of this edge For a quadratic bezier edge, this is the absolute value of the angle between control arms.
void print () const
 Print info.
 declare_iterators_canon (vertex, vertices, BezierVertex)
 declare_iterators_any (face, faces, BezierTriangle)

Static Public Member Functions

template<typename iterator>
static bool encroaches (Point2D p, const iterator &bounding_start, const iterator &bounding_end)
 Test whether the point encroaches on the curve bounded by the bounding polygon defined by points in the range [start, end].

Private Member Functions

void replace_cp (const ControlPoint &oldp, const ControlPoint &newp)
 Replace a control point. Used in bootstrapping. We assert the old point is actually part of the edge. Note: this function does *not* fix up the corresponding triangle or vertex.
 BezierEdge (const BezierEdge &o)
BezierEdgeoperator= (const BezierEdge &o)

Private Attributes

ControlPoint cp_ [3]
 An array of iterators, pointing to the geometric data (Point2D).
DataPoint dp_ [3]
 An array of iterators, pointing to the functional data (LinearData).
BoundaryEdgebdry_edge_
 The BoundaryEdge this edge is part of (NULL if no such BoundaryEdge).
double u_ [2]
 If on a boundary, then this is the u-value of the first and last vertex along the boundary.

Friends

class BezierMesh
std::ostream & operator<< (std::ostream &stream, const BezierEdge &e)

Detailed Description

The Edge type for BezierMesh.

As we are using a second order BezierBasis for our geometric and functional basis, each BezierEdge will have three ControlPoints and three DataPoints. Interpolation is done with the basis functions as:

$ \forall \alpha \in [0,1], B(\alpha) = (cp[0])\cdot \alpha^2 + (cp[1])\cdot 2\alpha (1 - \alpha) + (cp[2])\cdot (1-\alpha)^2 $

bedge.png

BezierEdge

Contains ControlPoints which point to the geometric Point2D information, and a DataPoints which point to the functional (LinearData) information. To get direct access to the information use the get_cp(int) and get_dp(int) methods.

Use the iterator functions (begin_vertices, begin_faces, etc) to access the sub-cells and super-cells of this edge.

Also contains information about the boundary. If this edge is part of a BoundaryEdge, then bdry points to that BoundaryEdge and u0 and u1 are the u-values of the vertex with index 0 and the vertex with index 1 respectivly. Thus, we should have that:

 edge->get_vertex(0)->get_u(edge->bdry, edge) == edge->u0

 edge->get_vertex(1)->get_u(edge->bdry, edge) == edge->u1

Note:
In the above code, we could not use simply, edge->get_vertex(0)->u , because that vertex might have been on a D0 vertex, and thus not have a unique u-value.
The u0 and u1 values for this edge will tell us how the mapping domains line-up between this edge and the BoundaryEdge. The following assertion will hold for i in 0...1:
 edge->evaluate(i) == edge->bdry->evaluate(edge->u0 + i * (edge->u1 - edge->u0))

Definition at line 593 of file cell.h.


Member Typedef Documentation

typedef EdgeCell BezierEdge::super

Definition at line 595 of file cell.h.


Constructor & Destructor Documentation

BezierEdge::BezierEdge ( PersistantStore ,
BezierVertex v1,
BezierVertex v2,
const ControlPoint ,
const DataStore  
)

Create an empty BezierEdge.

Definition at line 1070 of file cell.C.

References cp_, dp_, get_control_point(), BezierVertex::get_control_point(), get_num_cp(), and u_.

Here is the call graph for this function:

virtual BezierEdge::~BezierEdge (  )  [inline, virtual]

Definition at line 603 of file cell.h.

BezierEdge::BezierEdge ( const BezierEdge o  )  [private]


Member Function Documentation

void BezierEdge::set_bdry ( BoundaryEdge b,
double  u0,
double  u1 
)

Destructor.

Parameters:
b The BoundaryEdge this edge is part of
_u0 The u-value along b of vertexs[0]
_u1 The v-value along b of vertexs[1]

Definition at line 1091 of file cell.C.

References bdry_edge_, and u_.

Referenced by BezierMesh::insert_edge_midpoint(), MeshBinaryInput::read(), MeshInput::read(), BezierMesh::remove_vertex(), and ConformalMesher::reticulate_splines().

void BezierEdge::set_cp ( const Point2D p,
int  i 
)

Set the value of ControlPoint with given index.

Parameters:
p The new value at the ControlPoint
i The index of the control point [0<= i <=2]

Definition at line 1304 of file cell.C.

References access_cp().

Referenced by BezierMesh::smooth_edge().

Here is the call graph for this function:

void BezierEdge::set_dp ( const LinearData d,
int  i 
)

Set the value of DataPoint with given index.

Parameters:
d The new value at the DataPoint
i The index of the DataPoint [0<= i <=2]

Definition at line 1314 of file cell.C.

References access_dp().

Here is the call graph for this function:

void BezierEdge::set_data ( int  i,
int  pos,
double  data 
)

Set the value of DataPoint with given index, at the given position.

Parameters:
i The index of the DataPoint [0<= i <=2]
pos The position within the LinearData to set
data The value to set at the given position

Definition at line 1375 of file cell.C.

References access_dp(), and LinearData::set().

Here is the call graph for this function:

int BezierEdge::get_num_cp (  )  const [inline]

Definition at line 612 of file cell.h.

Referenced by access_cp(), access_dp(), BezierEdge(), get_control_point(), get_cp(), get_data_point(), get_dp(), is_encroached(), and replace_cp().

const Point2D & BezierEdge::get_cp ( int  i  )  const

Get the value of ControlPoint with given index.

Parameters:
i The index of the ControlPoint [0<= i <=2]
Returns:
The value of the ControlPoint

Definition at line 1324 of file cell.C.

References cp_, and get_num_cp().

Referenced by BezierMesh::can_flip(), BezierMesh::can_smooth(), curvature_angle(), BezierMesh::debug_flip(), BezierMesh::debug_smooth(), EPSWrite::draw_edge(), eval(), evalIntermediate(), BezierMesh::function_angle(), BezierMesh::get_flip_polygon(), BezierMesh::get_smooth_polygon(), Visualization::is_visible(), left_of_curve(), operator<<(), EPSWrite::shade_triangle(), BezierMesh::should_refine_func_angle(), and BezierMesh::smooth_edge().

Here is the call graph for this function:

Point2D & BezierEdge::access_cp ( int  i  ) 

Get read-write access to the point at position i.

Definition at line 1330 of file cell.C.

References PersistantList< Value >::iterator::access(), cp_, and get_num_cp().

Referenced by set_cp().

Here is the call graph for this function:

ControlPoint BezierEdge::get_control_point ( int  i  )  const

Direct access to the ControlPoint pointer.

Definition at line 1337 of file cell.C.

References cp_, and get_num_cp().

Referenced by BezierEdge(), BezierTriangle::BezierTriangle(), BezierMesh::consistency_check_helper(), BezierMesh::delete_edge(), BezierMesh::orient_edge_triangle(), and BezierMesh::replace_control_point().

Here is the call graph for this function:

const LinearData & BezierEdge::get_dp ( int  i  )  const

Get the value of DataPoint with given index.

Parameters:
i The index of the DataPoint [0<= i <=2]
Returns:
The value of the DataPoint

Definition at line 1347 of file cell.C.

References dp_, and get_num_cp().

Referenced by dataeval(), dataevalIntermediate(), BezierMesh::function_angle(), operator<<(), and BezierMesh::remove_vertex().

Here is the call graph for this function:

LinearData & BezierEdge::access_dp ( int  i  ) 

Get the value of DataPoint with given index.

Parameters:
i The index of the DataPoint [0<= i <=2]
Returns:
The value of the DataPoint

Definition at line 1357 of file cell.C.

References PersistantList< Value >::iterator::access(), dp_, and get_num_cp().

Referenced by BezierMesh::reinterpolate(), set_data(), and set_dp().

Here is the call graph for this function:

DataPoint BezierEdge::get_data_point ( int  i  )  const

Direct access to the DataPoint pointer.

Definition at line 1364 of file cell.C.

References dp_, and get_num_cp().

Referenced by BezierMesh::add_bezier_edge(), BezierMesh::consistency_check_helper(), and BezierMesh::delete_edge().

Here is the call graph for this function:

const BezierVertex * BezierEdge::get_vertex ( int  i  )  const

Get the BezierVertex that is a sub-cell of this edge, with given index.

Parameters:
i The index into the edge's set of vertexs [0<= i <=1]
Returns:
The BezierVertex that is a vertex of this edge, with given index

Reimplemented from EdgeCell.

Definition at line 1385 of file cell.C.

References EdgeCell::get_vertex().

Referenced by BezierTriangle::BezierTriangle(), BezierMesh::coarsen_calculate_edge_lengths(), BezierMesh::coarsen_keep_large_function_angles(), BezierMesh::consistency_check_helper(), BezierTriangle::get_edge_index_by_cps(), BezierVertex::get_u(), BezierMesh::insert_edge_midpoint(), and BezierTriangle::small_angle().

Here is the call graph for this function:

BezierVertex * BezierEdge::get_vertex ( int  i  ) 

Reimplemented from EdgeCell.

Definition at line 1389 of file cell.C.

References EdgeCell::get_vertex().

Here is the call graph for this function:

bool BezierEdge::is_boundary (  )  const

True if this is a boundary edge.

Definition at line 1395 of file cell.C.

References bdry_edge_.

Referenced by BezierMesh::clean_insert_edge_midpoint(), BezierMesh::clean_insert_point(), BezierMesh::delete_edge(), Visualization::draw_flippable_edges(), Visualization::draw_smoothable_edges(), MeshOutput::edge_to_file(), BezierMesh::flip(), get_bdry_edge(), BezierMesh::get_edge_neighbor_cells(), BezierMesh::insert_edge_midpoint(), BezierMesh::locate_point_in_linear_mesh(), operator<<(), BezierMesh::protect_boundarys(), BezierMesh::should_flip(), BezierMesh::should_refine_func_angle(), BezierTriangle::small_angle(), BezierMesh::smooth_edge(), and BezierMesh::smooth_mesh().

const BoundaryEdge * BezierEdge::get_bdry_edge (  )  const

Definition at line 1400 of file cell.C.

References bdry_edge_, and is_boundary().

Referenced by BezierVertex::get_u(), BezierMesh::insert_edge_midpoint(), operator<<(), and BezierTriangle::small_angle().

Here is the call graph for this function:

BoundaryEdge * BezierEdge::get_bdry_edge (  ) 

Definition at line 1405 of file cell.C.

References bdry_edge_, and is_boundary().

Here is the call graph for this function:

double BezierEdge::get_u ( int  i  )  const

Definition at line 1114 of file cell.C.

References u_.

Referenced by operator<<().

Point2D BezierEdge::eval ( double  u  )  const

Given a parameter in [0,1], interpolate the geometric coordinates in the Bezier Basis.

returns: $ B(\alpha) = (cp2) \cdot u^2 + (cp1)\cdot 2u (1 - u) + (cp0)\cdot (1-u)^2 $

Parameters:
u The parameter (u in [0, 1])
Returns:
The interpolated coordinates

Definition at line 1127 of file cell.C.

References get_cp().

Referenced by BezierMesh::clean_insert_edge_midpoint(), Visualization::draw_bezier_edge(), Visualization::draw_point(), and BezierMesh::insert_edge_midpoint().

Here is the call graph for this function:

LinearData BezierEdge::dataeval ( double  u  )  const

Given a parameter in [0,1], interpolate the functional value in the Bezier Basis.

returns: $ B(\alpha) = (dp2) \cdot u^2 + (dp1)\cdot 2u (1 - u) + (dp0)\cdot (1-u)^2 $

Parameters:
u The parameter (u in [0, 1])
Returns:
The interpolated functional values

Definition at line 1144 of file cell.C.

References get_dp().

Here is the call graph for this function:

void BezierEdge::evalIntermediate ( double  u,
Point2D p,
Point2D pc0,
Point2D pc1 
) const

Given a parameter in [0,1], interpolate the geometric coordinates in the Bezier Basis.

Runs the de Casteljau algorithm, and returns intermediates as well as the final interpolated value.

Parameters:
u The parameter (u in [0, 1])
[out] p The interpolated geometric point
[out] pc0 The first intermediate
[out] pc1 The second intermediate

Definition at line 1163 of file cell.C.

References get_cp().

Here is the call graph for this function:

void BezierEdge::dataevalIntermediate ( double  u,
LinearData d,
LinearData dc0,
LinearData dc1 
) const

Given a parameter in [0,1], interpolate the functional data in the Bezier Basis.

Runs the de Casteljau algorithm, and returns intermediates as well as the final interpolated value.

Parameters:
u The parameter (u in [0, 1])
[out] d The interpolated data point
[out] dc0 The first intermediate
[out] dc1 The second intermediate

Definition at line 1186 of file cell.C.

References get_dp().

Here is the call graph for this function:

bool BezierEdge::is_encroached ( const Point2D p  )  const

Determines id the given point encroaches this edge.

In the classic Delaunay refinement algorithms, one of the key procedures is checking an edge for encroachment. This occurs when a point enters the circumcircle of an edge.

For curved segments, we define encroachment using a convex bounding polygon for the curve. A point encroaches if it lies inside the diametral circle of any pair of point of the bounding polygon.

For Bezier segments, the control points define the bounding polygon.

Parameters:
p The point to test for encroachment
Returns:
true if this edge is encroached by given point

Definition at line 1215 of file cell.C.

References cp_, encroaches(), and get_num_cp().

Referenced by BezierMesh::clean_insert_edge_midpoint(), BezierMesh::clean_insert_point(), and BezierMesh::protect_boundarys().

Here is the call graph for this function:

template<typename iterator>
bool BezierEdge::encroaches ( Point2D  p,
const iterator &  bounding_start,
const iterator &  bounding_end 
) [inline, static]

Test whether the point encroaches on the curve bounded by the bounding polygon defined by points in the range [start, end].

Encroachment on curve is defined by encroachment on the dimetral circle of any pair of points on the curve. To compute this, we compute whether there is encroachment on the bounding polygon (is the point in the circumcircle of any pair of points on the polygon -- in particular, its vertices).

iterator::operator*() must return something on which operator-(Point2D) is defined and returns something on which a dot product is defined. For example: Point2D* has its * operator return a Point2D, on which operator-(Point2D) returns a Point2D, on which the dot product is defined.

Definition at line 882 of file cell.h.

Referenced by is_encroached().

int BezierEdge::left_of_curve ( Point2D p,
int  stop,
double &  approx 
) const

Determines if the point is left of the curve.

Ask Todd about this one.

Definition at line 1249 of file cell.C.

References get_cp(), and Point2D::is_left_of().

Here is the call graph for this function:

double BezierEdge::curvature_angle (  )  const

Returns the total turning (theta) of this edge For a quadratic bezier edge, this is the absolute value of the angle between control arms.

Returns:
the curvature angle in degrees

Definition at line 1227 of file cell.C.

References Point2D::dot(), get_cp(), and Point2D::mag().

Here is the call graph for this function:

void BezierEdge::print (  )  const

Print info.

Definition at line 1411 of file cell.C.

BezierEdge::declare_iterators_canon ( vertex  ,
vertices  ,
BezierVertex   
)

BezierEdge::declare_iterators_any ( face  ,
faces  ,
BezierTriangle   
)

void BezierEdge::replace_cp ( const ControlPoint oldp,
const ControlPoint newp 
) [private]

Replace a control point. Used in bootstrapping. We assert the old point is actually part of the edge. Note: this function does *not* fix up the corresponding triangle or vertex.

Definition at line 1103 of file cell.C.

References cp_, and get_num_cp().

Referenced by BezierMesh::replace_control_point().

Here is the call graph for this function:

BezierEdge& BezierEdge::operator= ( const BezierEdge o  )  [private]


Friends And Related Function Documentation

friend class BezierMesh [friend]

Definition at line 596 of file cell.h.

std::ostream& operator<< ( std::ostream &  stream,
const BezierEdge e 
) [friend]


Member Data Documentation

ControlPoint BezierEdge::cp_[3] [private]

An array of iterators, pointing to the geometric data (Point2D).

Definition at line 654 of file cell.h.

Referenced by access_cp(), BezierEdge(), get_control_point(), get_cp(), is_encroached(), and replace_cp().

DataPoint BezierEdge::dp_[3] [private]

An array of iterators, pointing to the functional data (LinearData).

Definition at line 655 of file cell.h.

Referenced by access_dp(), BezierEdge(), get_data_point(), and get_dp().

BoundaryEdge* BezierEdge::bdry_edge_ [private]

The BoundaryEdge this edge is part of (NULL if no such BoundaryEdge).

Definition at line 656 of file cell.h.

Referenced by get_bdry_edge(), is_boundary(), and set_bdry().

double BezierEdge::u_[2] [private]

If on a boundary, then this is the u-value of the first and last vertex along the boundary.

Definition at line 657 of file cell.h.

Referenced by BezierEdge(), get_u(), and set_bdry().


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