33 #ifndef __H__UG__SUBDIVISION_LOOP__
34 #define __H__UG__SUBDIVISION_LOOP__
48 template <
class TAVrtPos>
void
52 typedef typename TAVrtPos::ValueType pos_type;
59 bool usingTmpAttachment =
false;
62 usingTmpAttachment =
true;
63 aProjPos = TAVrtPos();
76 std::vector<NbrInfo> nbrInfos;
77 std::vector<Vertex*> vrts;
78 std::vector<number> nbrWgts;
100 for(
size_t i = 0; i < vrts.size(); ++i){
124 nbrs[numNbrs] = *iter;
135 VecScaleAdd(aaProjPos[v], w.x(), aaPos[v], w.y(), p0, w.z(), p1);
138 aaProjPos[v] = aaPos[v];
145 bool creaseNbr =
false;
150 UG_LOG(
"WARNING in ProjectToLimitPLoop: surface is not regular.");
151 UG_LOG(
" Ignoring vertex...\n");
152 aaProjPos[v] = aaPos[v];
156 nbrInfos.resize(vrts.size());
157 for(
size_t i = 0; i < vrts.size(); ++i)
164 size_t creaseValence = 0;
171 nbrInfos[i] = NbrInfo(nbrVrt, creaseValence);
174 nbrInfos[i] = NbrInfo(nbrVrt, 0);
182 nbrWgts.resize(vrts.size());
184 &nbrInfos.front(), nbrInfos.size());
187 VecScale(aaProjPos[v], aaPos[v], cntrWgt);
189 for(
size_t i = 0; i < nbrWgts.size(); ++i){
191 nbrWgts[i], aaPos[nbrInfos[i].nbr]);
199 for(
size_t i = 0; i < nbrInfos.size(); ++i){
202 aaPos[nbrInfos[i].nbr]);
210 if(usingTmpAttachment){
212 aaPos.
swap(aaProjPos);
221 template <
class TAVrtPos>
void
225 typedef typename TAVrtPos::ValueType pos_type;
232 bool usingTmpAttachment =
false;
233 if(aPos == aProjPos){
235 usingTmpAttachment =
true;
236 aProjPos = TAVrtPos();
263 nbrs[numNbrs] = *iter;
274 VecScaleAdd(aaProjPos[v], w.x(), aaPos[v], w.y(), p0, w.z(), p1);
277 aaProjPos[v] = aaPos[v];
281 aaProjPos[v] = aaPos[v];
286 if(usingTmpAttachment){
288 aaPos.
swap(aaProjPos);
void swap(AttachmentAccessor< TElem, TAttachment, TElemHandler > &acc)
calls swap on associated containers
Definition: attachment_pipe.h:560
Base-class for edges.
Definition: grid_base_objects.h:397
Manages the elements of a grid and their interconnection.
Definition: grid.h:132
EdgeContainer::iterator AssociatedEdgeIterator
used to iterate over associated edges of vertices, faces and volumes
Definition: grid.h:249
AssociatedEdgeIterator associated_edges_begin(Vertex *vrt)
DO NOT INVOKE! Subject to change.
Definition: grid.cpp:882
VertexIterator vertices_begin()
Definition: grid.h:513
size_t num() const
Definition: grid_impl.hpp:230
AssociatedEdgeIterator associated_edges_end(Vertex *vrt)
DO NOT INVOKE! Subject to change.
Definition: grid.cpp:892
VertexIterator vertices_end()
Definition: grid.h:514
void detach_from_vertices(IAttachment &attachment)
Definition: grid.h:787
bool has_vertex_attachment(IAttachment &attachment)
Definition: grid.h:798
void attach_to_vertices(IAttachment &attachment, bool passOnValues)
Definition: grid.h:728
A singleton that stores all rules for a piecewise-loop subdivision surface.
Definition: subdivision_rules_piecewise_loop.h:48
number proj_inner_nbr_weight(size_t valence) const
Definition: subdivision_rules_piecewise_loop.h:111
number proj_inner_center_weight(size_t valence) const
Definition: subdivision_rules_piecewise_loop.h:108
void proj_inner_crease_nbr_weights(number ¢erWgtOut, number *nbrWgtsOut, NeighborInfo *nbrInfos, size_t numNbrs) const
Definition: subdivision_rules_piecewise_loop.h:118
static SubdivRules_PLoop & inst()
returns the only instance to this singleton.
Definition: subdivision_rules_piecewise_loop.h:64
vector3 proj_crease_weights() const
Definition: subdivision_rules_piecewise_loop.h:114
Base-class for all vertex-types.
Definition: grid_base_objects.h:231
Volumes are 3-dimensional objects.
Definition: grid_base_objects.h:754
bool IsBoundaryEdge2D(Grid &grid, Edge *e)
returns whether an edge lies on the boundary of a 2D grid.
Definition: edge_util.cpp:112
bool IsBoundaryEdge3D(Grid &grid, Edge *e)
returns whether an edge lies on the boundary of a 3D grid.
Definition: edge_util.cpp:139
bool ProjectToLimitLoop(Grid &grid, APosition &aProjPos)
projects surface vertices to their limit subdivision surface position
Definition: subdivision_loop.cpp:43
void ProjectToLimitSubdivBoundary(Grid &grid, TAVrtPos aPos, TAVrtPos aProjPos)
projects all boundary vertices in the given grid to their limit-positions using the piecewise loop sc...
Definition: subdivision_loop.h:222
void ProjectToLimitPLoop(Grid &grid, TAVrtPos aPos, TAVrtPos aProjPos)
projects all vertices in the given grid to their limit-positions using the piecewise loop scheme.
Definition: subdivision_loop.h:49
bool IsBoundaryVertex2D(Grid &grid, Vertex *v)
returns whether a vertex lies on the boundary of a 2D grid.
Definition: vertex_util.cpp:531
bool CollectSurfaceNeighborsSorted(std::vector< Vertex * > &vNeighborsOut, Grid &grid, Vertex *v)
Collects neighbor-vertices in either clockwise or counter clockwise order.
Definition: vertex_util.cpp:217
Vertex * GetConnectedVertex(Edge *e, Vertex *v)
returns the vertex that is connected to v via e.
Definition: vertex_util.cpp:78
#define UG_LOG(msg)
Definition: log.h:367
double number
Definition: types.h:124
void VecScaleAdd(vector_t &vOut, typename vector_t::value_type s1, const vector_t &v1, typename vector_t::value_type s2, const vector_t &v2)
Scales two Vectors, adds them and returns the sum in a third vector.
Definition: math_vector_functions_common_impl.hpp:265
void VecScale(vector_t &vOut, const vector_t &v, typename vector_t::value_type s)
scales a MathVector<N>
Definition: math_vector_functions_common_impl.hpp:252
ElementStorage< Vertex >::SectionContainer::iterator VertexIterator
This Iterator will be used as base-class for iterators of specialized geometric objects.
Definition: grid_base_object_traits.h:73
APosition3 APosition
Definition: common_attachments.h:76
Definition: subdivision_rules_piecewise_loop.h:50