#include <mesherStrip.h>
Public Types | |
typedef PrimType | Prim |
typedef TYPENAME PrimType::Vertex | Vertex |
typedef TYPENAME PrimType::DAttrib | SAttrib |
typedef MesherEdge< PrimType > | Edge |
typedef plist< SAttrib > | Prims |
typedef plist< Edge * > | Edges |
typedef plist< const Vertex * > | Verts |
Public Member Functions | |
MesherStrip () | |
MesherStrip (const PrimType &prim, int index, const BuilderBucket &bucket) | |
MesherStrip (const MesherStrip ©) | |
Prim | make_prim (const BuilderBucket &bucket) |
Creates a PrimType element corresponding to the strip represented by this node. | |
void | measure_sheet (const Edge *edge, int new_row, int &num_prims, int &num_rows, int first_row_id, int this_row_id, int this_row_distance) |
void | cut_sheet (int first_row_id, int do_mate, const BuilderBucket &bucket) |
bool | mate (const BuilderBucket &bucket) |
Finds a neighboring strip and joins up with it to make a larger strip. | |
bool | find_ideal_mate (MesherStrip *&mate, Edge *&common_edge, const BuilderBucket &bucket) |
Searches our neighbors for the most suitable mate. | |
int | count_neighbors () const |
Returns the number of neighbors the strip shares. | |
ostream & | show_neighbors (ostream &out) const |
Writes all the neighbor indexes to the ostream. | |
bool | is_coplanar_with (const MesherStrip &other, float threshold) const |
Returns true if the strip and the other strip are coplanar. | |
float | coplanarity (const MesherStrip &other) const |
Returns the degree to which the two strips are coplanar. | |
int | type_category () const |
Returns an integer which gives a heuristic about the similarity of different strip types. | |
const Vertex * | find_uncommon_vertex (const Edge *edge) const |
Returns the first vertex found that is not shared by the given edge. | |
const Edge * | find_opposite_edge (const Vertex *vertex) const |
Returns the first edge found that does not contain the given vertex. | |
const Edge * | find_opposite_edge (const Edge *edge) const |
Returns the first edge found that shares no vertices with the given edge. | |
const Edge * | find_adjacent_edge (const Edge *edge) const |
Returns the first edge found that shares exactly one vertex with the given edge. | |
void | rotate_forward () |
Rotates a triangle or quad by bringing its second vertex to the front. | |
void | rotate_back () |
Rotates a triangle or quad by bringing its second vertex to the front. | |
void | rotate_to_front (const Edge *edge) |
Rotates a triangle or quad so that the given edge is first in the vertex list. | |
void | rotate_to_back (const Edge *edge) |
Rotates a triangle or quad so that the given edge is last in the vertex list. | |
bool | can_invert () const |
Returns true if the strip can be inverted (reverse its facing direction). | |
bool | invert () |
Reverses the facing of a quadstrip by reversing pairs of vertices. | |
Edge | get_head_edge () const |
Returns an Edge which represents the leading edge in the quadstrip or tristrip. | |
Edge | get_tail_edge () const |
Returns an Edge which represents the trailing edge in the quadstrip or tristrip. | |
bool | is_odd () const |
Returns true if the tristrip or quadstrip contains an odd number of pieces. | |
bool | would_reverse_tail (BuilderPrimType wantType) const |
Returns true if convert_to_type() would reverse the tail edge of the given strip, false otherwise. | |
void | convert_to_type (BuilderPrimType wantType) |
Converts the MesherStrip from whatever form it is--triangle, quad, or quadstrip--into a tristrip or quadstrip. | |
void | combine_edges (MesherStrip< PrimType > &other, int removeSides) |
Removes the edges from the given strip and appends them to our own. | |
void | remove_all_edges () |
Removes all active edges from the strip. | |
bool | operator== (const MesherStrip &other) const |
Defines equality for strips. | |
bool | operator!= (const MesherStrip &other) const |
bool | pick_mate (const MesherStrip &a_strip, const MesherStrip &b_strip, const Edge &a_edge, const Edge &b_edge, const BuilderBucket &bucket) const |
Defines an ordering to select neighbors to mate with. | |
bool | pick_sheet_mate (const MesherStrip &a_strip, const MesherStrip &b_strip) const |
Defines an ordering to select neighbors to follow when measuring out a quadsheet. | |
ostream & | output (ostream &out) const |
Formats the vertex for output in some sensible way. | |
Static Public Member Functions | |
bool | mate_pieces (Edge *common_edge, MesherStrip &front, MesherStrip &back, const BuilderBucket &bucket) |
Connects two pieces of arbitrary type, if possible. | |
bool | mate_strips (Edge *common_edge, MesherStrip &front, MesherStrip &back, BuilderPrimType type) |
Stitches two strips together, producing in "front" a new strip of the indicated type (quadstrip or tristrip). | |
bool | must_invert (const MesherStrip &front, const MesherStrip &back, bool will_reverse_back, BuilderPrimType type) |
Returns false if the strips can be mated as they currently are. | |
bool | convex_quad (Edge *common_edge, MesherStrip &front, MesherStrip &back, const BuilderBucket &bucket) |
Returns true if the quad that would be formed by connecting coplanar tris front and back along common_edge is convex, false otherwise. | |
Public Attributes | |
Prims | _prims |
Edges | _edges |
Verts | _verts |
BuilderPrimType | _type |
int | _index |
MesherStripStatus | _status |
int | _planar |
LVector3f | _plane_normal |
float | _plane_offset |
int | _row_id |
int | _row_distance |
int | _origin |
|
Definition at line 55 of file mesherStrip.h. Referenced by MesherStrip< PrimType >::rotate_back(), MesherStrip< PrimType >::rotate_forward(), and MesherStrip< PrimType >::would_reverse_tail(). |
|
Definition at line 125 of file mesherStrip.h. |
|
Definition at line 52 of file mesherStrip.h. |
|
Definition at line 124 of file mesherStrip.h. |
|
Definition at line 54 of file mesherStrip.h. |
|
Definition at line 53 of file mesherStrip.h. Referenced by MesherStrip< PrimType >::find_adjacent_edge(), MesherStrip< PrimType >::find_opposite_edge(), MesherStrip< PrimType >::invert(), MesherStrip< PrimType >::mate(), and MesherStrip< PrimType >::show_neighbors(). |
|
Definition at line 126 of file mesherStrip.h. |
|
Definition at line 57 of file mesherStrip.h. References INLINE. |
|
Definition at line 229 of file mesherStrip.I. |
|
Definition at line 26 of file mesherStrip.I. |
|
Returns true if the strip can be inverted (reverse its facing direction). Generally, this is true for quadstrips and false for tristrips. Definition at line 1357 of file mesherStrip.I. References MesherStrip< PrimType >::_verts, BPT_quad, BPT_quadstrip, BPT_tri, and BPT_tristrip. Referenced by MesherStrip< PrimType >::find_adjacent_edge(). |
|
Removes the edges from the given strip and appends them to our own. If removeSides is true, then removes all the edges except the head and the tail. Definition at line 1571 of file mesherStrip.I. References MesherStrip< PrimType >::type_category(). |
|
Converts the MesherStrip from whatever form it is--triangle, quad, or quadstrip--into a tristrip or quadstrip.
Definition at line 1494 of file mesherStrip.I. References MesherStrip< PrimType >::_prims, MesherStrip< PrimType >::_type, BPT_tri, MesherEdge< PrimType >::compute_length(), MesherStrip< PrimType >::coplanarity(), MesherStrip< PrimType >::count_neighbors(), and MesherStrip< PrimType >::type_category(). |
|
Returns true if the quad that would be formed by connecting coplanar tris front and back along common_edge is convex, false otherwise.
Definition at line 1022 of file mesherStrip.I. References MesherStrip< PrimType >::_edges, and TYPENAME. Referenced by MesherStrip< PrimType >::mate(). |
|
Returns the degree to which the two strips are coplanar. 0.0 is exactly coplanar; numbers somewhat larger than zero indicate less coplanar. 1.0 is at right angles; 2.0 is exactly backfacing. If either strip is not itself planar, 3.0 is returned. Definition at line 75 of file mesherStrip.I. References BPT_quad, BPT_quadstrip, BPT_tri, BPT_tristrip, and INLINE. Referenced by MesherStrip< PrimType >::convert_to_type(). |
|
Returns the number of neighbors the strip shares.
Definition at line 1104 of file mesherStrip.I. Referenced by MesherStrip< PrimType >::convert_to_type(). |
|
Definition at line 511 of file mesherStrip.I. References MS_alive. |
|
Returns the first edge found that shares exactly one vertex with the given edge. In a quad, this will be one of two edges adjacent to the given edge. Definition at line 1237 of file mesherStrip.I. References MesherStrip< PrimType >::_verts, MesherStrip< PrimType >::can_invert(), nassertr, t, TYPENAME, and MesherStrip< PrimType >::Vertex. |
|
Searches our neighbors for the most suitable mate. Returns true if one is found, false if we have no neighbors. Definition at line 652 of file mesherStrip.I. References TYPENAME. |
|
Returns the first edge found that shares no vertices with the given edge. In a quad, this will be the edge opposite the given edge. Definition at line 1208 of file mesherStrip.I. |
|
Returns the first edge found that does not contain the given vertex. In a tri, this will be the edge opposite the given vertex. Definition at line 1182 of file mesherStrip.I. References MesherEdge< PrimType >::_a, MesherEdge< PrimType >::_b, MesherStrip< PrimType >::_verts, MesherStrip< PrimType >::rotate_forward(), TYPENAME, and MesherStrip< PrimType >::Vertex. |
|
Returns the first vertex found that is not shared by the given edge.
Definition at line 1150 of file mesherStrip.I. References MesherStrip< PrimType >::_verts, MesherStrip< PrimType >::rotate_back(), and TYPENAME. |
|
Returns an Edge which represents the leading edge in the quadstrip or tristrip. This Edge will not have pointer equality with any shared Edge. Definition at line 164 of file mesherStrip.I. References INLINE, and MesherStrip< PrimType >::operator==(). Referenced by MesherStrip< PrimType >::is_odd(). |
|
Returns an Edge which represents the trailing edge in the quadstrip or tristrip. This Edge will not have pointer equality with any shared Edge. Definition at line 184 of file mesherStrip.I. References MesherStrip< PrimType >::_index, MesherStrip< PrimType >::_origin, MesherStrip< PrimType >::_prims, MesherStrip< PrimType >::_row_id, MesherStrip< PrimType >::_status, MesherStrip< PrimType >::_type, BPT_poly, BPT_quad, BPT_tri, MO_unknown, and MS_alive. Referenced by MesherStrip< PrimType >::is_odd(). |
|
Reverses the facing of a quadstrip by reversing pairs of vertices. Returns true if successful, false if failure (for instance, on a tristrip). Definition at line 1375 of file mesherStrip.I. References t, and MesherStrip< PrimType >::Vertex. |
|
Returns true if the strip and the other strip are coplanar.
Definition at line 53 of file mesherStrip.I. References MesherStrip< PrimType >::_planar, MesherStrip< PrimType >::_plane_normal, dot(), and INLINE. Referenced by MesherStrip< PrimType >::mate(). |
|
Returns true if the tristrip or quadstrip contains an odd number of pieces.
Definition at line 1410 of file mesherStrip.I. References MesherStrip< PrimType >::_edges, MesherStrip< PrimType >::get_head_edge(), MesherStrip< PrimType >::get_tail_edge(), and TYPENAME. |
|
Creates a PrimType element corresponding to the strip represented by this node.
Definition at line 290 of file mesherStrip.I. |
|
Finds a neighboring strip and joins up with it to make a larger strip. Returns true if mating was successful or at least possible, false if the strip has no neighbors. Definition at line 613 of file mesherStrip.I. References BuilderProperties::_coplanar_threshold, MesherStrip< PrimType >::_prims, BuilderProperties::_retesselate_coplanar, MesherStrip< PrimType >::_status, MesherStrip< PrimType >::_type, BPT_quad, BPT_tri, MesherStrip< PrimType >::convex_quad(), MesherStrip< PrimType >::is_coplanar_with(), MS_alive, nassertr, and MesherStrip< PrimType >::Vertex. Referenced by MesherStrip< PrimType >::measure_sheet(). |
|
Connects two pieces of arbitrary type, if possible. Returns true if successful, false if failure. Definition at line 691 of file mesherStrip.I. |
|
Stitches two strips together, producing in "front" a new strip of the indicated type (quadstrip or tristrip). The front strip stores the result, and the back strip is emptied on success. Returns true if successful, false if failure (generally because of incorrect polarity of tristrips), in which case nothing has changed (or at least, not much). Definition at line 855 of file mesherStrip.I. |
|
Definition at line 372 of file mesherStrip.I. References MesherStrip< PrimType >::_edges, MesherStrip< PrimType >::mate(), NULL, MesherStrip< PrimType >::pick_sheet_mate(), and TYPENAME. |
|
Returns false if the strips can be mated as they currently are. Returns true if the back strip must be inverted first. Definition at line 980 of file mesherStrip.I. References t. |
|
Definition at line 216 of file mesherStrip.I. References MesherStrip< PrimType >::_planar, MesherStrip< PrimType >::_plane_normal, MesherStrip< PrimType >::_plane_offset, and Vertexf. |
|
Defines equality for strips. This actually tests only pointer equality; it's used only when removing a strip from the list. Definition at line 203 of file mesherStrip.I. Referenced by MesherStrip< PrimType >::get_head_edge(). |
|
Formats the vertex for output in some sensible way.
Definition at line 1759 of file mesherStrip.I. |
|
Defines an ordering to select neighbors to mate with. This compares strip a with strip b and returns true if strip a is the preferable choice, false if strip b. Definition at line 1660 of file mesherStrip.I. |
|
Defines an ordering to select neighbors to follow when measuring out a quadsheet. This is only called when three or more prims share a single edge, which should be rarely--generally only when coplanar polys are going on. Definition at line 1726 of file mesherStrip.I. Referenced by MesherStrip< PrimType >::measure_sheet(). |
|
Removes all active edges from the strip. This effectively renders it ineligible to mate with anything else. Definition at line 1631 of file mesherStrip.I. |
|
Rotates a triangle or quad by bringing its second vertex to the front.
Definition at line 144 of file mesherStrip.I. References MesherStrip< PrimType >::_verts, MesherStrip< PrimType >::Edge, INLINE, and TYPENAME. Referenced by MesherStrip< PrimType >::find_uncommon_vertex(). |
|
Rotates a triangle or quad by bringing its second vertex to the front.
Definition at line 127 of file mesherStrip.I. References MesherStrip< PrimType >::_verts, MesherStrip< PrimType >::Edge, INLINE, and TYPENAME. Referenced by MesherStrip< PrimType >::find_opposite_edge(). |
|
Rotates a triangle or quad so that the given edge is last in the vertex list.
Definition at line 1309 of file mesherStrip.I. References MesherStrip< PrimType >::_verts. |
|
Rotates a triangle or quad so that the given edge is first in the vertex list.
Definition at line 1264 of file mesherStrip.I. References MesherStrip< PrimType >::_type, MesherStrip< PrimType >::_verts, BPT_quad, and BPT_quadstrip. |
|
Writes all the neighbor indexes to the ostream.
Definition at line 1124 of file mesherStrip.I. References MesherStrip< PrimType >::_edges, TYPENAME, and MesherStrip< PrimType >::Vertex. |
|
Returns an integer which gives a heuristic about the similarity of different strip types. In general, closer numbers are more similar. Definition at line 97 of file mesherStrip.I. References MesherStrip< PrimType >::_verts, and INLINE. Referenced by MesherStrip< PrimType >::combine_edges(), and MesherStrip< PrimType >::convert_to_type(). |
|
Returns true if convert_to_type() would reverse the tail edge of the given strip, false otherwise.
Definition at line 1434 of file mesherStrip.I. References MesherEdge< PrimType >::_a, MesherEdge< PrimType >::_b, and MesherStrip< PrimType >::Edge. |
|
Definition at line 129 of file mesherStrip.h. Referenced by MesherStrip< PrimType >::convex_quad(), MesherStrip< PrimType >::is_odd(), MesherStrip< PrimType >::measure_sheet(), and MesherStrip< PrimType >::show_neighbors(). |
|
Definition at line 133 of file mesherStrip.h. Referenced by MesherStrip< PrimType >::get_tail_edge(). |
|
Definition at line 140 of file mesherStrip.h. Referenced by MesherStrip< PrimType >::get_tail_edge(). |
|
Definition at line 136 of file mesherStrip.h. Referenced by MesherStrip< PrimType >::is_coplanar_with(), and MesherStrip< PrimType >::operator!=(). |
|
Definition at line 137 of file mesherStrip.h. Referenced by MesherStrip< PrimType >::is_coplanar_with(), and MesherStrip< PrimType >::operator!=(). |
|
Definition at line 138 of file mesherStrip.h. Referenced by MesherStrip< PrimType >::operator!=(). |
|
Definition at line 128 of file mesherStrip.h. Referenced by MesherStrip< PrimType >::convert_to_type(), MesherStrip< PrimType >::get_tail_edge(), and MesherStrip< PrimType >::mate(). |
|
Definition at line 139 of file mesherStrip.h. |
|
Definition at line 139 of file mesherStrip.h. Referenced by MesherStrip< PrimType >::get_tail_edge(). |
|
Definition at line 134 of file mesherStrip.h. Referenced by MesherStrip< PrimType >::get_tail_edge(), and MesherStrip< PrimType >::mate(). |
|
Definition at line 132 of file mesherStrip.h. Referenced by MesherStrip< PrimType >::convert_to_type(), MesherStrip< PrimType >::get_tail_edge(), MesherStrip< PrimType >::mate(), and MesherStrip< PrimType >::rotate_to_front(). |
|