mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-19 14:41:25 +00:00
committed by
Dion Moult
parent
af1e542064
commit
1b5b9fdcf6
@@ -1313,7 +1313,7 @@ class ActivateBcfViewpoint(bpy.types.Operator):
|
|||||||
x_axis = y_axis.cross(z_axis).normalized()
|
x_axis = y_axis.cross(z_axis).normalized()
|
||||||
rotation = Matrix((x_axis, y_axis, z_axis))
|
rotation = Matrix((x_axis, y_axis, z_axis))
|
||||||
rotation.invert()
|
rotation.invert()
|
||||||
matrix = np.matrix(
|
matrix = np.array(
|
||||||
(
|
(
|
||||||
[x_axis[0], y_axis[0], z_axis[0], camera.camera_view_point.x],
|
[x_axis[0], y_axis[0], z_axis[0], camera.camera_view_point.x],
|
||||||
[x_axis[1], y_axis[1], z_axis[1], camera.camera_view_point.y],
|
[x_axis[1], y_axis[1], z_axis[1], camera.camera_view_point.y],
|
||||||
|
|||||||
@@ -19,7 +19,6 @@
|
|||||||
import math
|
import math
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import ifcopenshell
|
import ifcopenshell
|
||||||
import ifcopenshell.util.unit
|
|
||||||
import ifcopenshell.util.element
|
import ifcopenshell.util.element
|
||||||
import ifcopenshell.util.placement
|
import ifcopenshell.util.placement
|
||||||
from typing import NamedTuple, Optional, Union
|
from typing import NamedTuple, Optional, Union
|
||||||
@@ -422,12 +421,12 @@ def local2global(
|
|||||||
]
|
]
|
||||||
)
|
)
|
||||||
result = rotation_matrix @ scale_and_factor_matrix @ matrix
|
result = rotation_matrix @ scale_and_factor_matrix @ matrix
|
||||||
result[:, 0][0:3] /= np.linalg.norm(result[:, 0][0:3])
|
result[:3, 0] /= np.linalg.norm(result[:3, 0])
|
||||||
result[:, 1][0:3] /= np.linalg.norm(result[:, 1][0:3])
|
result[:3, 1] /= np.linalg.norm(result[:3, 1])
|
||||||
result[:, 2][0:3] /= np.linalg.norm(result[:, 2][0:3])
|
result[:3, 2] /= np.linalg.norm(result[:3, 2])
|
||||||
result[0][3] += eastings
|
result[0, 3] += eastings
|
||||||
result[1][3] += northings
|
result[1, 3] += northings
|
||||||
result[2][3] += orthogonal_height
|
result[2, 3] += orthogonal_height
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
@@ -455,9 +454,7 @@ def auto_local2global(
|
|||||||
result = local2global(matrix, *parameters)
|
result = local2global(matrix, *parameters)
|
||||||
if should_return_in_map_units:
|
if should_return_in_map_units:
|
||||||
return result
|
return result
|
||||||
result[0][3] /= parameters.scale
|
result[:3, 3] /= parameters.scale
|
||||||
result[1][3] /= parameters.scale
|
|
||||||
result[2][3] /= parameters.scale
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
@@ -512,13 +509,13 @@ def global2local(
|
|||||||
]
|
]
|
||||||
)
|
)
|
||||||
result = matrix.copy()
|
result = matrix.copy()
|
||||||
result[0][3] -= eastings
|
result[0, 3] -= eastings
|
||||||
result[1][3] -= northings
|
result[1, 3] -= northings
|
||||||
result[2][3] -= orthogonal_height
|
result[2, 3] -= orthogonal_height
|
||||||
result = np.linalg.inv(scale_and_factor_matrix) @ np.linalg.inv(rotation_matrix) @ result
|
result = np.linalg.inv(scale_and_factor_matrix) @ np.linalg.inv(rotation_matrix) @ result
|
||||||
result[:, 0][0:3] /= np.linalg.norm(result[:, 0][0:3])
|
result[:3, 0] /= np.linalg.norm(result[:3, 0])
|
||||||
result[:, 1][0:3] /= np.linalg.norm(result[:, 1][0:3])
|
result[:3, 1] /= np.linalg.norm(result[:3, 1])
|
||||||
result[:, 2][0:3] /= np.linalg.norm(result[:, 2][0:3])
|
result[:3, 2] /= np.linalg.norm(result[:3, 2])
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
@@ -543,9 +540,7 @@ def auto_global2local(
|
|||||||
return matrix.copy()
|
return matrix.copy()
|
||||||
if not is_specified_in_map_units:
|
if not is_specified_in_map_units:
|
||||||
matrix = matrix.copy()
|
matrix = matrix.copy()
|
||||||
matrix[0][3] *= parameters.scale
|
matrix[:3, 3] *= parameters.scale
|
||||||
matrix[1][3] *= parameters.scale
|
|
||||||
matrix[2][3] *= parameters.scale
|
|
||||||
result = global2local(matrix, *parameters)
|
result = global2local(matrix, *parameters)
|
||||||
wcs = get_wcs(ifc_file)
|
wcs = get_wcs(ifc_file)
|
||||||
if wcs is not None:
|
if wcs is not None:
|
||||||
|
|||||||
Reference in New Issue
Block a user