-
Notifications
You must be signed in to change notification settings - Fork 32
Changes supporting GPU shaping branch #1748
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
4dca792
00287c0
ae4cb2b
3bcfcb5
edf4143
2e8175c
18b0709
4af2c02
803cac0
7d4c8f3
dced476
ed0c117
f29ccdf
7bf2c2b
3326535
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -66,6 +66,17 @@ class CoordinateTransformer | |
| */ | ||
| CoordinateTransformer(const numerics::Matrix<T>& matrix) { setMatrix(matrix); } | ||
|
|
||
| /*! | ||
| * @brief Construct transformer that moves 4 starting points to 4 | ||
| * destination points. | ||
| * @see setByTerminusPts. | ||
| */ | ||
| AXOM_HOST_DEVICE CoordinateTransformer(const primal::Point<T, 3>* startPts, | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A little ASCII art diagram could be useful. I assume it's something like this:
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, I'm not sure I understand. The 4 starting and ending points can be anywhere. This constructor simply calls
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess I don't understand what the 4 points represent then. That's what I would want to know.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @gunney1 , correct me if I'm wrong, but I think you use this ctor to transform an arbitrary tet to a unit tet like the one @BradWhitlock diagrammed. Perhaps you could make ASCII art showing the tet before transformation and use Brad's as the tet after transformation.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It can transform an arbitrary tet to a unit tet but only if you specify a unit tet as the second 4 points. We can transform any tet to any other tet.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @BradWhitlock you can think of the 4 points as providing the required information to define the transformation. There are 12 unknowns in the matrix so you need 12 constraints, which are the 4 3D points. I guess if it helps to think of the points as tet vertices, I could write that...
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe something like "If you think of each 4 points as the vertices of a tetrahedron, the transformation moves the starting tet to the destination tet." |
||
| const primal::Point<T, 3>* destPts) | ||
| { | ||
| setByTerminusPts(startPts, destPts); | ||
| } | ||
|
|
||
| /*! | ||
| * @brief Set the matrix, discarding the current transformation. | ||
| * @param matrix [in] The transformation matrix for homogeneous | ||
|
|
@@ -100,8 +111,10 @@ class CoordinateTransformer | |
| * @param [in] destPts Four destination points. | ||
| * | ||
| * The four starting points must define a non-degenerate volume. | ||
| * Else the transformation is ill-defined and the transformer | ||
| * is set to invalid. | ||
| * Else the transformation is ill-defined and the transformer is set | ||
| * to invalid. If you think of each 4 points as the vertices of a | ||
| * tetrahedron, the transformation moves the starting tet to the | ||
| * destination tet. | ||
| */ | ||
| AXOM_HOST_DEVICE void setByTerminusPts(const primal::Point<T, 3>* startPts, | ||
| const primal::Point<T, 3>* destPts) | ||
|
|
@@ -206,18 +219,17 @@ class CoordinateTransformer | |
| */ | ||
| void applyRotation(const axom::primal::Vector<T, 3>& start, const axom::primal::Vector<T, 3>& end) | ||
| { | ||
| // Note that the rotation matrix is not unique. | ||
| Vector<T, 3> s = start.unitVector(); | ||
| Vector<T, 3> e = end.unitVector(); | ||
| Vector<T, 3> u; // Rotation vector, the cross product of start and end. | ||
| numerics::cross_product(s.data(), e.data(), u.data()); | ||
| const T sinT = u.norm(); | ||
| const T cosT = numerics::dot_product(s.data(), e.data(), 3); | ||
|
|
||
| // Degenerate: end is parallel to start. | ||
| // angle near 0 (identity transform) or pi. | ||
| if(utilities::isNearlyEqual(sinT, 0.0)) | ||
| { | ||
| // Degenerate: end is parallel to start. | ||
| // angle near 0 (identity transform) or pi. | ||
| if(cosT < 0) | ||
| { | ||
| setInvalid(); // Transformation is ill-defined | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.