-
Notifications
You must be signed in to change notification settings - Fork 114
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
removed RotateUp and uint #1000
Changes from all commits
74b74c7
548f377
0452de2
a5a9099
a8af0c2
d04b754
985bb2d
f837cb9
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 |
---|---|---|
|
@@ -513,6 +513,10 @@ Manifold::Impl Manifold::Impl::Transform(const mat3x4& transform_) const { | |
result.status_ = status_; | ||
return result; | ||
} | ||
if (!all(la::isfinite(transform_))) { | ||
result.MarkFailure(Error::NonFiniteVertex); | ||
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. Added this to catch any kind of bad transform. 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. Apparently we need to make it explicit, i.e. 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. fwiw, in BRL-CAD when we use C++ we generally are explicit with the namespaces to avoid lookup surprises. It's definitely a readability tradeoff though. |
||
return result; | ||
} | ||
result.collider_ = collider_; | ||
result.meshRelation_ = meshRelation_; | ||
result.precision_ = precision_; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -126,16 +126,12 @@ struct UpdateProperties { | |
|
||
struct CheckHalfedges { | ||
VecView<const Halfedge> halfedges; | ||
VecView<const vec3> vertPos; | ||
|
||
bool operator()(size_t edge) const { | ||
const Halfedge halfedge = halfedges[edge]; | ||
if (halfedge.startVert == -1 || halfedge.endVert == -1) return true; | ||
if (halfedge.pairedHalfedge == -1) return false; | ||
|
||
if (!std::isfinite(vertPos[halfedge.startVert][0])) return false; | ||
if (!std::isfinite(vertPos[halfedge.endVert][0])) return false; | ||
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. Not sure when this showed up, but we have a dedicated |
||
|
||
const Halfedge paired = halfedges[halfedge.pairedHalfedge]; | ||
bool good = true; | ||
good &= paired.pairedHalfedge == static_cast<int>(edge); | ||
|
@@ -199,7 +195,7 @@ namespace manifold { | |
bool Manifold::Impl::IsManifold() const { | ||
if (halfedge_.size() == 0) return true; | ||
return all_of(countAt(0_uz), countAt(halfedge_.size()), | ||
CheckHalfedges({halfedge_, vertPos_})); | ||
CheckHalfedges({halfedge_})); | ||
} | ||
|
||
/** | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,6 @@ | |
#ifdef MANIFOLD_CROSS_SECTION | ||
#include "manifold/cross_section.h" | ||
#endif | ||
#include "../src/utils.h" // For RotateUp | ||
#include "manifold/manifold.h" | ||
#include "manifold/polygon.h" | ||
#include "test.h" | ||
|
@@ -1053,13 +1052,8 @@ TEST(BooleanComplex, SimpleOffset) { | |
vec3 vpos(seeds.vertProperties[3 * i + 0], seeds.vertProperties[3 * i + 1], | ||
seeds.vertProperties[3 * i + 2]); | ||
Manifold vsph = sph.Translate(vpos); | ||
if (!vsph.NumTri()) continue; | ||
c += vsph; | ||
// See above discussion | ||
EXPECT_EQ(c.Status(), Manifold::Error::NoError); | ||
} | ||
// See above discussion | ||
// EXPECT_EQ(c.Status(), Manifold::Error::NoError); | ||
// Edge Cylinders | ||
for (size_t i = 0; i < edges.size(); i++) { | ||
vec3 ev1 = vec3(seeds.vertProperties[3 * edges[i].first + 0], | ||
|
@@ -1071,20 +1065,12 @@ TEST(BooleanComplex, SimpleOffset) { | |
vec3 edge = ev2 - ev1; | ||
double len = la::length(edge); | ||
if (len < std::numeric_limits<float>::min()) continue; | ||
// TODO - workaround, shouldn't be necessary | ||
if (len < 0.03) continue; | ||
manifold::Manifold origin_cyl = manifold::Manifold::Cylinder(len, 1, 1, 8); | ||
vec3 evec(-1 * edge.x, -1 * edge.y, edge.z); | ||
manifold::Manifold rotated_cyl = | ||
origin_cyl.Transform(manifold::RotateUp(evec)); | ||
manifold::Manifold right = rotated_cyl.Translate(ev1); | ||
if (!right.NumTri()) continue; | ||
quat q = rotation_quat(normalize(evec), vec3(0, 0, 1)); | ||
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. @pca006132 I was a little suprised I didn't need 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 think this is a weird thing called Argument-dependent lookup for functions, which basically adds the argument type namespaces into the lookup search path. I don't think we have anything wrong with our namespacing. 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. Oh, that's cool! Thanks for the explanation. |
||
manifold::Manifold right = origin_cyl.Transform({la::qmat(q), ev1}); | ||
c += right; | ||
// See above discussion | ||
EXPECT_EQ(c.Status(), Manifold::Error::NoError); | ||
} | ||
// See above discussion | ||
// EXPECT_EQ(c.Status(), Manifold::Error::NoError); | ||
// Triangle Volumes | ||
for (size_t i = 0; i < seeds.NumTri(); i++) { | ||
int eind[3]; | ||
|
@@ -1098,6 +1084,7 @@ TEST(BooleanComplex, SimpleOffset) { | |
vec3 a = ev[0] - ev[2]; | ||
vec3 b = ev[1] - ev[2]; | ||
vec3 n = la::normalize(la::cross(a, b)); | ||
if (!all(isfinite(n))) continue; | ||
// Extrude the points above and below the plane of the triangle | ||
vec3 pnts[6]; | ||
for (int j = 0; j < 3; j++) pnts[j] = ev[j] + n; | ||
|
@@ -1123,13 +1110,12 @@ TEST(BooleanComplex, SimpleOffset) { | |
for (int j = 0; j < 24; j++) | ||
tri_m.triVerts.insert(tri_m.triVerts.end(), faces[j]); | ||
manifold::Manifold right(tri_m); | ||
if (!right.NumTri()) continue; | ||
c += right; | ||
// See above discussion | ||
EXPECT_EQ(c.Status(), Manifold::Error::NoError); | ||
} | ||
// See above discussion | ||
// EXPECT_EQ(c.Status(), Manifold::Error::NoError); | ||
EXPECT_EQ(c.Status(), Manifold::Error::NoError); | ||
} | ||
|
||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed this to pass through the input error instead of changing it, which I think makes it a be easier to deduce what went wrong first.