mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-19 14:41:25 +00:00
Fix #3498.
This commit is contained in:
@@ -1628,7 +1628,10 @@ class Drawing(blenderbim.core.tool.Drawing):
|
|||||||
# Based on separating axis theorem
|
# Based on separating axis theorem
|
||||||
plane_co = camera.matrix_world.translation
|
plane_co = camera.matrix_world.translation
|
||||||
plane_no = camera.matrix_world.col[2].xyz
|
plane_no = camera.matrix_world.col[2].xyz
|
||||||
|
return cls.is_intersecting_plane(obj, plane_co, plane_no)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def is_intersecting_plane(cls, obj, plane_co, plane_no):
|
||||||
# Broadphase check using the bounding box
|
# Broadphase check using the bounding box
|
||||||
bounding_box_world_coords = [obj.matrix_world @ Vector(coord) for coord in obj.bound_box]
|
bounding_box_world_coords = [obj.matrix_world @ Vector(coord) for coord in obj.bound_box]
|
||||||
bounding_box_signed_distances = [plane_no.dot(v - plane_co) for v in bounding_box_world_coords]
|
bounding_box_signed_distances = [plane_no.dot(v - plane_co) for v in bounding_box_world_coords]
|
||||||
@@ -1666,6 +1669,13 @@ class Drawing(blenderbim.core.tool.Drawing):
|
|||||||
# Bisect verts are offset by the clip (with 5mm tolerance) to ensure it is visible in the viewport.
|
# Bisect verts are offset by the clip (with 5mm tolerance) to ensure it is visible in the viewport.
|
||||||
global_offset = camera.matrix_world.col[2].xyz * (-camera.data.clip_start - 0.005)
|
global_offset = camera.matrix_world.col[2].xyz * (-camera.data.clip_start - 0.005)
|
||||||
|
|
||||||
|
return cls.bisect_mesh_with_plane(obj, plane_co, plane_no, global_offset=global_offset)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def bisect_mesh_with_plane(cls, obj, plane_co, plane_no, global_offset=None):
|
||||||
|
if global_offset is None:
|
||||||
|
global_offset = Vector()
|
||||||
|
|
||||||
bm = bmesh.new()
|
bm = bmesh.new()
|
||||||
bm.from_mesh(obj.data)
|
bm.from_mesh(obj.data)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user