Plugins
coordinate_transform_tools.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013-2017: G-CSC, Goethe University Frankfurt
3  * Author: Sebastian Reiter
4  *
5  * This file is part of UG4.
6  *
7  * UG4 is free software: you can redistribute it and/or modify it under the
8  * terms of the GNU Lesser General Public License version 3 (as published by the
9  * Free Software Foundation) with the following additional attribution
10  * requirements (according to LGPL/GPL v3 §7):
11  *
12  * (1) The following notice must be displayed in the Appropriate Legal Notices
13  * of covered and combined works: "Based on UG4 (www.ug4.org/license)".
14  *
15  * (2) The following notice must be displayed at a prominent place in the
16  * terminal output of covered works: "Based on UG4 (www.ug4.org/license)".
17  *
18  * (3) The following bibliography is recommended for citation and must be
19  * preserved in all covered files:
20  * "Reiter, S., Vogel, A., Heppner, I., Rupp, M., and Wittum, G. A massively
21  * parallel geometric multigrid solver on hierarchically distributed grids.
22  * Computing and visualization in science 16, 4 (2013), 151-164"
23  * "Vogel, A., Reiter, S., Rupp, M., Nägel, A., and Wittum, G. UG4 -- a novel
24  * flexible software system for simulating pde based models on high performance
25  * computers. Computing and visualization in science 16, 4 (2013), 165-179"
26  *
27  * This program is distributed in the hope that it will be useful,
28  * but WITHOUT ANY WARRANTY; without even the implied warranty of
29  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30  * GNU Lesser General Public License for more details.
31  */
32 
33 #ifndef __H__PROMESH__coordinate_transform_tools__
34 #define __H__PROMESH__coordinate_transform_tools__
35 
36 #include <vector>
37 #include "../mesh.h"
43 
44 #define TOOLTIP_GET_SELECTION_CENTER ""
45 #define TOOLTIP_MOVE_SELECTION_TO "Moves the selected elements so that the new selection center will lie at the specified position."
46 #define TOOLTIP_MOVE_ALONG_NORMAL "Moves selected vertices along their normal by the specified offset."
47 #define TOOLTIP_SCALE_AROUND_CENTER "Scales the selected elements around the center of the current selection."
48 #define TOOLTIP_SCALE_AROUND_PIVOT "Scales the selected elements around the pivot of the mesh."
49 #define TOOLTIP_SCALE_AROUND_POINT "Scales the selected geometry around the given point"
50 #define TOOLTIP_ROTATE_AROUND_CENTER "Rotates the selected elements around the center of the current selection."
51 #define TOOLTIP_ROTATE_AROUND_PIVOT "Rotates the selected elements around the pivot of the mesh."
52 #define TOOLTIP_COORDINATES "Coordinates of the center of the current selection"
53 #define TOOLTIP_MOVE "Moves selected vertices."
54 #define TOOLTIP_MOVE_MESH_TO "Moves the active mesh and its pivot, so that the pivot will be located on the specified position."
55 #define TOOLTIP_NORMAL_MOVE "Moves selected vertices along their normal."
56 #define TOOLTIP_MOVE_VERTICES_ALONG_EDGES "Moves selected vertices along selected edges by an offset relative to those selected edges. If a selected vertex is connected to multiple selected edges, the new position will be averaged between the individual offsets."
57 #define TOOLTIP_MOVE_VERTICES_TO_EDGE_LENGTH "Moves selected vertices along selected edges so that those edges obtain the specified length. If a selected vertex is connected to multiple selected edges, the new position will be averaged between the individual new positions."
58 #define TOOLTIP_MOVE_VERTICES_TO_PROJECTED_EDGE_LENGTH "Moves selected vertices along selected edges so that the projection of those edges into the plain with the specified normal obtain the specified length. If a selected vertex is connected to multiple selected edges, the new position will be averaged between the individual new positions."
59 #define TOOLTIP_SCALE "Scales the coordinates of the selected vertices around their center."
60 #define TOOLTIP_ROTATE "Rotates the geometry by the given degrees around its center."
61 #define TOOLTIP_MIRROR "Mirrors the geometry at the given point along the given axis"
62 #define TOOLTIP_TRANSFORM "Transforms the vertices with the given matrix"
63 #define TOOLTIP_CONE_TRANSFORM "Transforms the vertices with the given cone transformation"
64 #define TOOLTIP_LAPLACIAN_SMOOTH "Smoothes vertices in a grid."
65 #define TOOLTIP_WEIGHTED_EDGE_SMOOTH "Smoothes vertices along edges in a grid with special weights for non-smoothed vertices."
66 #define TOOLTIP_WEIGHTED_FACE_SMOOTH "Smoothes vertices across faces in a grid with special weights for non-smoothed vertices."
67 #define TOOLTIP_WEIGHTED_NORMAL_SMOOTH "The higher the dot-product between an outgoing edge and the vertex normal, the higher the influence of that edge during smoothing of that vertex."
68 #define TOOLTIP_SLOPE_SMOOTH "Smoothes the grid so that the geometry is linearized along the path of steepest descent."
69 #define TOOLTIP_TANGENTIAL_SMOOTH "Smoothes vertices on a manifold."
70 #define TOOLTIP_RPOJECT_TO_PLANE "Projects all selected elements to the specified plane"
71 #define TOOLTIP_PROJECT_TO_LIMIT_PLOOP "Projects all vertices in the grid to their limit positions as defined by the piecewise loop scheme."
72 #define TOOLTIP_PROJECT_TO_LIMIT_SMOOTH_BOUNDARY "Projects all boundary-vertices in the grid to their limit positions as defined by the b-spline subdivision scheme."
73 #define TOOLTIP_SET_PIVOT "Sets the pivot point of the selected object."
74 #define TOOLTIP_SET_PIVOT_TO_SELECTION_CENTER "Sets the pivot to the center of the current selection."
75 #define TOOLTIP_SET_PIVOT_TO_MESH_CENTER "Sets the pivot to the center of the active mesh."
76 #define TOOLTIP_FLATTEN_BENT_QUADRILATERALS "Flattens bent quadrilaterals using an iterative flattening scheme"
77 #define TOOLTIP_APPLY_HEIGHT_FIELD "Calculates z-values of all nodes in terms of their x and y values."
78 #define TOOLTIP_SNAP_VERTICES_TO_VERTICES "Snaps the selected vertices of the specified mesh to the selected vertices of the target mesh"
79 
80 namespace ug{
81 namespace promesh{
82 
85 bool GetSelectionCenter(Mesh* obj, vector3& centerOut);
86 
87 bool MoveSelectionTo(Mesh* obj, const vector3& center);
88 
89 void Move(Mesh* obj, const vector3& offset);
90 
91 void MoveMeshTo(Mesh* obj, const vector3& newPos);
92 
93 void MoveAlongNormal(Mesh* obj, number offset);
94 
95 void MoveVerticesAlongEdges(Mesh* obj, number relVal);
96 
97 void MoveVerticesToEdgeLength(Mesh* obj, number edgeLen);
98 
99 void MoveVerticesToProjectedEdgeLength (Mesh* obj,
100  number projEdgeLen,
101  const vector3& projNormal);
102 
103 void ScaleAroundCenter(Mesh* obj, const vector3& scale);
104 
105 void ScaleAroundPivot(Mesh* obj, const vector3& scale);
106 
107 void ScaleAroundPoint(Mesh* obj, const vector3& scale, const vector3& point);
108 
109 void RotateAroundCenter(Mesh* obj, const vector3& rot);
110 
111 void RotateAroundPivot(Mesh* obj, const vector3& rot);
112 
113 void Mirror(Mesh* obj, const vector3& axis, const vector3& origin);
114 
115 void ConeTransform( Mesh* obj,
116  const vector3& base,
117  const vector3& axis,
118  number scaleAtTip);
119 
120 void LaplacianSmooth(Mesh* obj, number alpha, int numIterations);
121 
122 void WeightedEdgeSmooth(Mesh* obj, number alpha, int numIterations);
123 
124 void WeightedFaceSmooth(Mesh* obj, number alpha, int numIterations);
125 
126 void WeightedNormalSmooth( Mesh* obj,
127  number alpha,
128  number dotThreshold,
129  int numIterations);
130 
131 void SlopeSmooth(Mesh* obj, number alpha, int numIterations);
132 
133 void TangentialSmooth(Mesh* obj, number alpha, int numIterations);
134 
135 void ProjectToLimitPLoop(Mesh* obj);
136 
137 void ProjectToLimitSmoothBoundary(Mesh* obj);
138 
139 void SetPivot(Mesh* obj, const vector3& pos);
140 
141 void SetPivotToSelectionCenter(Mesh* obj);
142 
143 void SetPivotToMeshCenter(Mesh* obj);
144 
145 void FlattenBentQuadrilaterals(Mesh* obj, number stepSize, int numIterations);
146 
147 void ProjectToPlane( Mesh* obj,
148  const vector3& planeCenter,
149  const vector3& planeNormal);
150 
151 void SnapVerticesToVertices(Mesh* obj, Mesh* targetMesh);
152 
154 
155 }}// end of namespace
156 
157 #endif
void SlopeSmooth(Mesh *obj, number alpha, int numIterations)
Definition: coordinate_transform_tools.cpp:471
void ScaleAroundPoint(Mesh *obj, const vector3 &scale, const vector3 &point)
Definition: coordinate_transform_tools.cpp:279
void ScaleAroundCenter(Mesh *obj, const vector3 &scale)
Definition: coordinate_transform_tools.cpp:241
void ProjectToPlane(Mesh *obj, const vector3 &planeCenter, const vector3 &planeNormal)
Definition: coordinate_transform_tools.cpp:557
void SetPivotToMeshCenter(Mesh *obj)
Definition: coordinate_transform_tools.cpp:517
void WeightedEdgeSmooth(Mesh *obj, number alpha, int numIterations)
Definition: coordinate_transform_tools.cpp:446
void RotateAroundCenter(Mesh *obj, const vector3 &rotRad)
Definition: coordinate_transform_tools.cpp:353
bool MoveSelectionTo(Mesh *obj, const vector3 &center)
Definition: coordinate_transform_tools.cpp:47
void ProjectToLimitSmoothBoundary(Mesh *obj)
Definition: coordinate_transform_tools.cpp:497
void MoveAlongNormal(Mesh *obj, number offset)
Definition: coordinate_transform_tools.cpp:74
void SnapVerticesToVertices(Mesh *obj, Mesh *targetMesh)
Definition: coordinate_transform_tools.cpp:572
void SetPivot(Mesh *obj, const vector3 &pos)
Definition: coordinate_transform_tools.cpp:504
bool GetSelectionCenter(Mesh *obj, vector3 &centerOut)
Definition: coordinate_transform_tools.cpp:41
void ProjectToLimitPLoop(Mesh *obj)
Definition: coordinate_transform_tools.cpp:490
void TangentialSmooth(Mesh *obj, number alpha, int numIterations)
Definition: coordinate_transform_tools.cpp:481
void RotateAroundPivot(Mesh *obj, const vector3 &rotRad)
Definition: coordinate_transform_tools.cpp:380
void MoveVerticesToProjectedEdgeLength(Mesh *obj, number projEdgeLen, const vector3 &projNormal)
Definition: coordinate_transform_tools.cpp:186
void LaplacianSmooth(Mesh *obj, number alpha, int numIterations)
Definition: coordinate_transform_tools.cpp:437
void ConeTransform(Mesh *obj, const vector3 &base, const vector3 &axis, number scaleAtTip)
Definition: coordinate_transform_tools.cpp:407
void WeightedFaceSmooth(Mesh *obj, number alpha, int numIterations)
Definition: coordinate_transform_tools.cpp:453
void MoveVerticesToEdgeLength(Mesh *obj, number edgeLen)
Definition: coordinate_transform_tools.cpp:142
void MoveMeshTo(Mesh *obj, const vector3 &newPos)
Definition: coordinate_transform_tools.cpp:65
void WeightedNormalSmooth(Mesh *obj, number alpha, number dotThreshold, int numIterations)
Definition: coordinate_transform_tools.cpp:460
void MoveVerticesAlongEdges(Mesh *obj, number relVal)
Definition: coordinate_transform_tools.cpp:102
void FlattenBentQuadrilaterals(Mesh *obj, number stepSize, int numIterations)
Definition: coordinate_transform_tools.cpp:524
void Mirror(Mesh *obj, const vector3 &axisOrig, const vector3 &origin)
Definition: coordinate_transform_tools.cpp:323
void SetPivotToSelectionCenter(Mesh *obj)
Definition: coordinate_transform_tools.cpp:510
void ScaleAroundPivot(Mesh *obj, const vector3 &scale)
Definition: coordinate_transform_tools.cpp:260
void Move(Mesh *obj, const vector3 &offset)
Definition: coordinate_transform_tools.cpp:60
double number
static void rot(number A[3][3], const number s, const number tau, const int i, const int j, const int k, const int l)