mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-22 03:10:56 +00:00
bcfp numpy 2.0+ support #5080
`np.float_` is deprecated, it was just an alias for `np.float64`
This commit is contained in:
@@ -5,8 +5,8 @@ from numpy.typing import NDArray
|
|||||||
|
|
||||||
|
|
||||||
def camera_vectors_from_element_placement(
|
def camera_vectors_from_element_placement(
|
||||||
elem_placement: NDArray[np.float_],
|
elem_placement: NDArray[np.float64],
|
||||||
) -> tuple[NDArray[np.float_], NDArray[np.float_], NDArray[np.float_]]:
|
) -> tuple[NDArray[np.float64], NDArray[np.float64], NDArray[np.float64]]:
|
||||||
"""
|
"""
|
||||||
Calculate the vectors of a camera pointing to an element.
|
Calculate the vectors of a camera pointing to an element.
|
||||||
|
|
||||||
@@ -21,8 +21,8 @@ def camera_vectors_from_element_placement(
|
|||||||
|
|
||||||
|
|
||||||
def camera_vectors_from_target_position(
|
def camera_vectors_from_target_position(
|
||||||
target_position: NDArray[np.float_], offset: Optional[NDArray[np.float_]] = None
|
target_position: NDArray[np.float64], offset: Optional[NDArray[np.float64]] = None
|
||||||
) -> tuple[NDArray[np.float_], NDArray[np.float_], NDArray[np.float_]]:
|
) -> tuple[NDArray[np.float64], NDArray[np.float64], NDArray[np.float64]]:
|
||||||
"""
|
"""
|
||||||
Calculate the vectors of a camera pointing to a target point.
|
Calculate the vectors of a camera pointing to a target point.
|
||||||
|
|
||||||
@@ -50,7 +50,7 @@ def camera_vectors_from_target_position(
|
|||||||
# return camera_position, -mat[:3, 2], mat[:3, 1]
|
# return camera_position, -mat[:3, 2], mat[:3, 1]
|
||||||
|
|
||||||
|
|
||||||
def unit_vector(v: NDArray[np.float_]) -> NDArray[np.float_]:
|
def unit_vector(v: NDArray[np.float64]) -> NDArray[np.float64]:
|
||||||
"""
|
"""
|
||||||
Return the unit vector of a vector.
|
Return the unit vector of a vector.
|
||||||
|
|
||||||
|
|||||||
@@ -278,7 +278,7 @@ class TopicHandler:
|
|||||||
self.add_visinfo_handler(new_viewpoint)
|
self.add_visinfo_handler(new_viewpoint)
|
||||||
return new_viewpoint
|
return new_viewpoint
|
||||||
|
|
||||||
def add_viewpoint_from_point_and_guids(self, position: NDArray[np.float_], *guids: str) -> None:
|
def add_viewpoint_from_point_and_guids(self, position: NDArray[np.float64], *guids: str) -> None:
|
||||||
"""Add a viewpoint pointing at an XYZ point in space
|
"""Add a viewpoint pointing at an XYZ point in space
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
|
|||||||
@@ -176,7 +176,7 @@ class VisualizationInfoHandler:
|
|||||||
@classmethod
|
@classmethod
|
||||||
def create_from_point_and_guids(
|
def create_from_point_and_guids(
|
||||||
cls,
|
cls,
|
||||||
position: NDArray[np.float_],
|
position: NDArray[np.float64],
|
||||||
*guids: str,
|
*guids: str,
|
||||||
xml_handler: Optional[AbstractXmlParserSerializer] = None,
|
xml_handler: Optional[AbstractXmlParserSerializer] = None,
|
||||||
) -> "VisualizationInfoHandler":
|
) -> "VisualizationInfoHandler":
|
||||||
@@ -224,7 +224,7 @@ def build_viewpoint(element: entity_instance) -> mdl.VisualizationInfo:
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def build_viewpoint_from_position_and_guids(position: NDArray[np.float_], *guids: str) -> mdl.VisualizationInfo:
|
def build_viewpoint_from_position_and_guids(position: NDArray[np.float64], *guids: str) -> mdl.VisualizationInfo:
|
||||||
"""
|
"""
|
||||||
Return a BCF viewpoint of an IFC element.
|
Return a BCF viewpoint of an IFC element.
|
||||||
|
|
||||||
@@ -261,7 +261,7 @@ def build_components(*guids: str) -> mdl.Components:
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def build_camera(elem_placement: NDArray[np.float_]) -> mdl.PerspectiveCamera:
|
def build_camera(elem_placement: NDArray[np.float64]) -> mdl.PerspectiveCamera:
|
||||||
"""
|
"""
|
||||||
Return a BCF camera for an IFC element placement matrix.
|
Return a BCF camera for an IFC element placement matrix.
|
||||||
|
|
||||||
@@ -275,7 +275,7 @@ def build_camera(elem_placement: NDArray[np.float_]) -> mdl.PerspectiveCamera:
|
|||||||
|
|
||||||
|
|
||||||
def build_camera_from_vectors(
|
def build_camera_from_vectors(
|
||||||
camera_position: NDArray[np.float_], camera_dir: NDArray[np.float_], camera_up: NDArray[np.float_]
|
camera_position: NDArray[np.float64], camera_dir: NDArray[np.float64], camera_up: NDArray[np.float64]
|
||||||
) -> mdl.PerspectiveCamera:
|
) -> mdl.PerspectiveCamera:
|
||||||
"""
|
"""
|
||||||
Return a BCF camera for an IFC element placement matrix.
|
Return a BCF camera for an IFC element placement matrix.
|
||||||
|
|||||||
@@ -175,7 +175,7 @@ class TopicHandler:
|
|||||||
new_viewpoint = VisualizationInfoHandler.create_new(element, self._xml_handler)
|
new_viewpoint = VisualizationInfoHandler.create_new(element, self._xml_handler)
|
||||||
self.add_visinfo_handler(new_viewpoint)
|
self.add_visinfo_handler(new_viewpoint)
|
||||||
|
|
||||||
def add_viewpoint_from_point_and_guids(self, position: NDArray[np.float_], *guids: str) -> None:
|
def add_viewpoint_from_point_and_guids(self, position: NDArray[np.float64], *guids: str) -> None:
|
||||||
"""
|
"""
|
||||||
Add a viewpoint tergeting an IFC element to the topic.
|
Add a viewpoint tergeting an IFC element to the topic.
|
||||||
|
|
||||||
|
|||||||
@@ -175,7 +175,7 @@ class VisualizationInfoHandler:
|
|||||||
@classmethod
|
@classmethod
|
||||||
def create_from_point_and_guids(
|
def create_from_point_and_guids(
|
||||||
cls,
|
cls,
|
||||||
position: NDArray[np.float_],
|
position: NDArray[np.float64],
|
||||||
*guids: str,
|
*guids: str,
|
||||||
xml_handler: Optional[AbstractXmlParserSerializer] = None,
|
xml_handler: Optional[AbstractXmlParserSerializer] = None,
|
||||||
) -> "VisualizationInfoHandler":
|
) -> "VisualizationInfoHandler":
|
||||||
@@ -218,7 +218,7 @@ def build_viewpoint(element: entity_instance) -> mdl.VisualizationInfo:
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def build_viewpoint_from_position_and_guids(position: NDArray[np.float_], *guids: str) -> mdl.VisualizationInfo:
|
def build_viewpoint_from_position_and_guids(position: NDArray[np.float64], *guids: str) -> mdl.VisualizationInfo:
|
||||||
"""
|
"""
|
||||||
Return a BCF viewpoint of an IFC element.
|
Return a BCF viewpoint of an IFC element.
|
||||||
|
|
||||||
@@ -255,7 +255,7 @@ def build_components(*guids: str) -> mdl.Components:
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def build_camera(elem_placement: NDArray[np.float_]) -> mdl.PerspectiveCamera:
|
def build_camera(elem_placement: NDArray[np.float64]) -> mdl.PerspectiveCamera:
|
||||||
"""
|
"""
|
||||||
Return a BCF camera for an IFC element placement matrix.
|
Return a BCF camera for an IFC element placement matrix.
|
||||||
|
|
||||||
@@ -269,7 +269,7 @@ def build_camera(elem_placement: NDArray[np.float_]) -> mdl.PerspectiveCamera:
|
|||||||
|
|
||||||
|
|
||||||
def build_camera_from_vectors(
|
def build_camera_from_vectors(
|
||||||
camera_position: NDArray[np.float_], camera_dir: NDArray[np.float_], camera_up: NDArray[np.float_]
|
camera_position: NDArray[np.float64], camera_dir: NDArray[np.float64], camera_up: NDArray[np.float64]
|
||||||
) -> mdl.PerspectiveCamera:
|
) -> mdl.PerspectiveCamera:
|
||||||
"""
|
"""
|
||||||
Return a BCF camera for an IFC element placement matrix.
|
Return a BCF camera for an IFC element placement matrix.
|
||||||
|
|||||||
Reference in New Issue
Block a user