Details
-
Bug
-
Resolution: Out of scope
-
P2: Important
-
None
-
5.0.0
-
None
Description
float QTriangle3D::intersection(const QRay3D &ray) const
seems to deliver wrong results.
The point calculated on the planes surface does not always return true when tested with contains.
It seems to be a problem with the test against the triangles normal which is the first test done in contains.
the normal is not normalized and can be a large value which leads to qFuzzyIsNull returning false for the intersection point calculated before.
example:
ray with origin (0, 0, 0) and direction (0.995806098, 0.017942428, 0.08971226215)
triangle with (70, -15, 6), (70, 15, 6), (40, 15, 6)
possible solution:
normalize the normal used to test for a component perpendicular to the planes surface.
hints:
other 3D geometry classes should be checked, wheter they may use similar checks which may lead to this error (normals should always be normalized?!?)
More Info:
In this particular case its a problem in contains().
The calculated normal should be normalized.
But it is a general problem with the 3D classes.
The normals (from plane and triangle) are not normalized but they are used to test for contains() in a qFuzzyIsNull() comparison.
For large normals this may lead to Problems.
At least the call to QTriangle3D::intersection(const QRay3D &ray) should be consistent!
You calculate a point on the triangles plane which is then checked in a contains() call on the triangle and returns false.
I think you need to have a look at all the basic geometry classes and check the normalization of normals and how they are used.
Attachments
For Gerrit Dashboard: QTBUG-29158 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
46932,1 | Fixed QTriangle3D::intersects(). | dev | qt/qt3d | Status: ABANDONED | +1 | 0 |
47133,1 | Fixed QTriangle3D::intersects(). | master | qt/qt3d | Status: MERGED | +2 | 0 |
47137,1 | Fixed QTriangle3D::contains() being too strict for large triangles. | master | qt/qt3d | Status: MERGED | +2 | 0 |