Measurement: Partially fixed the common gizmo raycaster for self-intersecting meshes
This commit is contained in:
parent
c98ba0e651
commit
6dac9f2aca
@ -409,6 +409,12 @@ bool MeshRaycaster::unproject_on_mesh(const Vec2d& mouse_pos, const Transform3d&
|
||||
Vec3d direction;
|
||||
line_from_mouse_pos(mouse_pos, trafo, camera, point, direction);
|
||||
|
||||
if (rand()%100 == 0) {
|
||||
int a=5;
|
||||
int b=6;
|
||||
int c=7;
|
||||
}
|
||||
|
||||
std::vector<AABBMesh::hit_result> hits = m_emesh.query_ray_hits(point, direction);
|
||||
|
||||
if (hits.empty())
|
||||
@ -429,10 +435,10 @@ bool MeshRaycaster::unproject_on_mesh(const Vec2d& mouse_pos, const Transform3d&
|
||||
// All hits are clipped.
|
||||
return false;
|
||||
}
|
||||
if ((hits.size()-i) % 2 != 0) {
|
||||
if (clipping_plane && (hits.size()-i) % 2 != 0) {
|
||||
// There is an odd number of unclipped hits - meaning the nearest must be from inside the mesh.
|
||||
// In that case, calculate intersection with the clipping place.
|
||||
if (clipping_plane && was_clipping_plane_hit) {
|
||||
if (was_clipping_plane_hit) {
|
||||
direction = direction + point;
|
||||
point = trafo * point; // transform to world coords
|
||||
direction = trafo * direction - point;
|
||||
|
Loading…
Reference in New Issue
Block a user