Fix linking project missing offsets for instances of complex geometry

After ba2456a if main IFC project had an offset and linked object had more than 333 faces, then it was imported at it's original location instead, missing an offset.

Also processing occurrences should be now more optimized, since we reuse the same verts buffer instead of recreating it 10 times.
This commit is contained in:
Andrej730
2025-07-22 14:18:55 +05:00
parent 8f5905c801
commit 0ef255bc3c
2 changed files with 27 additions and 23 deletions
@@ -157,6 +157,20 @@ def np_angle_signed(a: VectorType, b: VectorType) -> float:
return np.arctan2(det, dot)
def np_translation_matrix(vector: VectorType) -> npt.NDArray[np.float64]:
"""Get translation matrix.
Designed to be similar to mathutils Matrix.Rotation but to use numpy.
:param vector: 3D translation vector.
:return: An 4x4 identity matrix with a translation
"""
eye = np.eye(4, dtype=np.float64)
M_TRANSLATION = (slice(0, 3), 3)
eye[M_TRANSLATION] = vector
return eye
def np_rotation_matrix(
angle: float, size: int, axis: Optional[Union[Literal["X", "Y", "Z"], VectorType]] = None
) -> np.ndarray: