diffCheck.df-b_geometries modules

Contents

diffCheck.df-b_geometries modules#

This page contains 2 modules for the geometries:

  1. diffCheck.df_geometries module contains all the objects and functions to handle geometries of a structure in the DiffCheck library.

  2. diffCheck.diffcheck_bindings.dfb_geometry module contains all the objects and functions to handle mesh and point cloud geometries in diffCheck.

diffCheck.df_geometries module#

This module represent the geometry of a structure in the DiffCheck library. It contains the following classes:

This is how these geometris are related:

        stateDiagram-v2
 DFAssembly
   state DFAssembly {

      [*] --> DFBeam
      state DFBeam {

         [*] --> DFJoint
         DFJoint --> DFFace

         state DFFace {
            [*] --> DFVertex
         }
      }
   }
    

Caution

The diffCheck.df_geometries.DFJoint is only generated when accessed from the diffCheck.df_geometries.DFAssembly or diffCheck.df_geometries.DFBeam objects. It exists only as a convinience container for the joints.

class diffCheck.df_geometries.DFAssembly(beams, name)#

Bases: object

This class represents an assembly of beams

Parameters:
add_beam(beam)#
Parameters:

beam (DFBeam)

property all_joint_faces#
property all_joints#
property all_side_faces#
property all_vertices#
beams: List[DFBeam]#
compute_all_joint_angles()#

This function computes the angles between the beam’s axis and the joints’jointfaces’ normals.

Return type:

List[float]

compute_all_joint_distances_to_midpoint()#

This function computes the distances from the center of the assembly to each joint.

Return type:

List[float]

deepcopy()#

Create a deep copy of the assembly

dump_xml(pretty_xml, dir)#

Dump the pretty XML to a file

Parameters:
  • pretty_xml (str) – The pretty XML string

  • dir (str) – The directory to save the XML

property has_only_one_beam#
property mass_center#
name: str#
remove_beam(beam_assembly_index)#

Remove a beam from the assembly

Parameters:

beam_assembly_index (int)

to_xml()#

Dump the assembly’s meshes to an XML file. On top of the DiffCheck datatypes and structure, we export the underlaying beams’s meshes from Rhino as vertices and faces.

Return xml_string:

The pretty XML string

property total_number_joints#
property uuid#
class diffCheck.df_geometries.DFBeam(name, faces)#

Bases: object

This class represents a beam, in diffCheck, a beam is a collection of faces

Parameters:
property axis#
property center#
compute_axis(is_unitized=True)#

This is an utility function that computes the axis of the beam as a line. The axis is calculated as the vector passing through the two most distance joint’s centroids.

Return axis:

The axis of the beam as a line

Return type:

Line

Parameters:

is_unitized (bool)

compute_joint_angles()#

This function computes the angles between the beam’s axis and the joints’jointfaces’ normals. The angles are remapped between 0 and 90 degrees, where -1 indicates the bottom of any half-lap joint.

Return angles:

The angles between the beam’s axis and the joints’jointfaces’ normals

Return type:

List[float]

compute_joint_distances_to_midpoint()#

This function computes the distances from the center of the beam to each joint.

Return type:

List[float]

deepcopy()#
faces: List[DFFace]#
classmethod from_brep_face(brep, is_roundwood=False)#

Create a DFBeam from a RhinoBrep object. It also removes duplicates and creates a list of unique faces.

property index_assembly#
property joint_faces#
property joints#
property length#
name: str#
property number_joints#
property side_faces#
to_brep()#

Convert the beam to a Rhino Brep object

to_mesh(max_edge_length)#

Convert the beam to a Rhino Mesh object

property uuid#
property vertices#
class diffCheck.df_geometries.DFFace(all_loops, joint_id=None)#

Bases: object

This class represents a face, in diffCheck, a face is a collection of vertices.

Parameters:
all_loops: List[List[DFVertex]]#
property center#
deepcopy()#
classmethod from_brep_face(brep_face, joint_id=None)#

Create a DFFace from a Rhino Brep face

Parameters:
  • brep_face (BrepFace) – The Rhino Brep face

  • joint_id (Optional[int]) – The joint id

Return face:

The DFFace object

property is_joint#
joint_id: Optional[int] = None#
property normal#
to_brep_face()#

Convert the face to a Rhino Brep planar face

Return brep_face:

The Rhino Brep planar face

to_mesh()#

Convert the face to a Rhino Mesh

Return mesh:

The Rhino Mesh object

property uuid#
class diffCheck.df_geometries.DFJoint(id, faces)#

Bases: object

This class represents a joint, in diffCheck, a joint is a collection of faces For convenience, this is used only as a return type from the DFBeam class’s property for retrieveing joints

Parameters:
property center#
deepcopy()#
faces: List[DFFace]#
id: int#
to_brep()#

Convert the joint to a Rhino Brep object

to_mesh(max_edge_length)#

Convert the joint to a Rhino Mesh object

property uuid#

It retrives the automatic identifier, not the one of the joint in the beam

class diffCheck.df_geometries.DFVertex(x, y, z)#

Bases: object

This class represents a vertex, a simple container with 3 coordinates

Parameters:
deepcopy()#
classmethod from_rg_point3d(point)#

Create a DFVertex from a Rhino Point3d object

Parameters:

point (Point3d) – The Rhino Point3d object

Return vertex:

The DFVertex object

to_rg_point3d()#

Convert the vertex to a Rhino Point3d object

Return point:

The Rhino Point3d object

property uuid#
x: float#
y: float#
z: float#

diffCheck.diffcheck_bindings.dfb_geometry module#

A submodule for wrap geometries in df.

class diffCheck.diffcheck_bindings.dfb_geometry.DFMesh#

Bases: pybind11_object

A class for the triangle mesh representation.

property colors_face#
property colors_vertex#
compute_distance(self: diffCheck.diffcheck_bindings.dfb_geometry.DFMesh, target_cloud: diffCheck.diffcheck_bindings.dfb_geometry.DFPointCloud, is_abs: bool = True) list[float]#
property faces#
get_num_faces(self: diffCheck.diffcheck_bindings.dfb_geometry.DFMesh) int#
get_num_vertices(self: diffCheck.diffcheck_bindings.dfb_geometry.DFMesh) int#
get_tight_bounding_box(self: diffCheck.diffcheck_bindings.dfb_geometry.DFMesh) list[numpy.ndarray[numpy.float64[3, 1]]]#
load_from_PLY(self: diffCheck.diffcheck_bindings.dfb_geometry.DFMesh, arg0: str) None#
property normals_face#
property normals_vertex#
sample_points_uniformly(self: diffCheck.diffcheck_bindings.dfb_geometry.DFMesh, arg0: int) diffCheck.diffcheck_bindings.dfb_geometry.DFPointCloud#
property vertices#
class diffCheck.diffcheck_bindings.dfb_geometry.DFPointCloud#

Bases: pybind11_object

A class for the point cloud representation.

add_points(self: diffCheck.diffcheck_bindings.dfb_geometry.DFPointCloud, arg0: diffCheck.diffcheck_bindings.dfb_geometry.DFPointCloud) None#
apply_color(self: diffCheck.diffcheck_bindings.dfb_geometry.DFPointCloud, r: int, g: int, b: int) None#
apply_transformation(self: diffCheck.diffcheck_bindings.dfb_geometry.DFPointCloud, transformation: diffCheck::transformation::DFTransformation) None#
property colors#
compute_distance(self: diffCheck.diffcheck_bindings.dfb_geometry.DFPointCloud, target_cloud: diffCheck.diffcheck_bindings.dfb_geometry.DFPointCloud) list[float]#
downsample_by_size(self: diffCheck.diffcheck_bindings.dfb_geometry.DFPointCloud, target_size: int) None#
estimate_normals(self: diffCheck.diffcheck_bindings.dfb_geometry.DFPointCloud, use_cilantro_evaluator: bool = False, knn: int | None = 100, search_radius: float | None = None) None#
get_axis_aligned_bounding_box(self: diffCheck.diffcheck_bindings.dfb_geometry.DFPointCloud) list[numpy.ndarray[numpy.float64[3, 1]]]#
get_center_point(self: diffCheck.diffcheck_bindings.dfb_geometry.DFPointCloud) numpy.ndarray[numpy.float64[3, 1]]#
get_num_colors(self: diffCheck.diffcheck_bindings.dfb_geometry.DFPointCloud) int#
get_num_normals(self: diffCheck.diffcheck_bindings.dfb_geometry.DFPointCloud) int#
get_num_points(self: diffCheck.diffcheck_bindings.dfb_geometry.DFPointCloud) int#

Get the number of points in the point cloud.

get_tight_bounding_box(self: diffCheck.diffcheck_bindings.dfb_geometry.DFPointCloud) list[numpy.ndarray[numpy.float64[3, 1]]]#
has_colors(self: diffCheck.diffcheck_bindings.dfb_geometry.DFPointCloud) bool#
has_normals(self: diffCheck.diffcheck_bindings.dfb_geometry.DFPointCloud) bool#
has_points(self: diffCheck.diffcheck_bindings.dfb_geometry.DFPointCloud) bool#
load_from_PLY(self: diffCheck.diffcheck_bindings.dfb_geometry.DFPointCloud, arg0: str) None#
property normals#
property points#
remove_statistical_outliers(self: diffCheck.diffcheck_bindings.dfb_geometry.DFPointCloud, nb_neighbors: int, std_ratio: float) None#
save_to_PLY(self: diffCheck.diffcheck_bindings.dfb_geometry.DFPointCloud, arg0: str) None#
uniform_downsample(self: diffCheck.diffcheck_bindings.dfb_geometry.DFPointCloud, every_k_points: int) None#
voxel_downsample(self: diffCheck.diffcheck_bindings.dfb_geometry.DFPointCloud, voxel_size: float) None#