Skip to content

Commit 5683c05

Browse files
fix: use plane instead of pose
1 parent 12bd9e3 commit 5683c05

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/gh/components/DF_pose_comparison/code.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
class DFPoseComparison(component):
1414
def RunScript(self,
1515
i_assembly: diffCheck.df_geometries.DFAssembly,
16-
i_measured_poses: System.Collections.Generic.List[object]):
16+
i_measured_planes: System.Collections.Generic.List[object]):
1717

1818
CAD_poses = [beam.plane for beam in i_assembly.beams]
1919

@@ -22,20 +22,20 @@ def RunScript(self,
2222
o_transforms_cad_to_measured = []
2323
# Compare the origins
2424
# measure the distance between the origins of the CAD pose and the measured pose and output this in the component
25-
for i in range(len(i_measured_poses)):
26-
if not i_measured_poses[i]:
25+
for i in range(len(i_measured_planes)):
26+
if not i_measured_planes[i]:
2727
o_distances.append(None)
2828
o_angles.append(None)
2929
o_transforms_cad_to_measured.append(None)
3030
continue
3131
cad_origin = CAD_poses[i].Origin
32-
measured_origin = i_measured_poses[i].Origin
32+
measured_origin = i_measured_planes[i].Origin
3333
distance = cad_origin.DistanceTo(measured_origin)
3434
o_distances.append(distance)
3535

3636
# Compare the orientations using the formula: $$ \theta = \arccos\left(\frac{\text{trace}(R_{\text{pred}}^T R_{\text{meas}}) - 1}{2}\right) $$
3737
transform_o_to_cad = Rhino.Geometry.Transform.PlaneToPlane(Rhino.Geometry.Plane.WorldXY, CAD_poses[i])
38-
transform_o_to_measured = Rhino.Geometry.Transform.PlaneToPlane(Rhino.Geometry.Plane.WorldXY, i_measured_poses[i])
38+
transform_o_to_measured = Rhino.Geometry.Transform.PlaneToPlane(Rhino.Geometry.Plane.WorldXY, i_measured_planes[i])
3939
np_transform_o_to_cad = numpy.array(transform_o_to_cad.ToDoubleArray(rowDominant=True)).reshape((4, 4))
4040
np_transform_o_to_measured = numpy.array(transform_o_to_measured.ToDoubleArray(rowDominant=True)).reshape((4, 4))
4141

@@ -46,7 +46,7 @@ def RunScript(self,
4646
o_angles.append(theta)
4747

4848
# Compute the transformation matrix between the CAD pose and the measured pose
49-
transform_cad_to_measured = Rhino.Geometry.Transform.PlaneToPlane(CAD_poses[i], i_measured_poses[i])
49+
transform_cad_to_measured = Rhino.Geometry.Transform.PlaneToPlane(CAD_poses[i], i_measured_planes[i])
5050
o_transforms_cad_to_measured.append(transform_cad_to_measured)
5151

5252
return [o_distances, o_angles, o_transforms_cad_to_measured]

src/gh/components/DF_pose_comparison/metadata.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626
"typeHintID": "ghdoc"
2727
},
2828
{
29-
"name": "i_measured_poses",
30-
"nickname": "i_measured_poses",
31-
"description": "The measured poses to compare against the CAD poses.",
29+
"name": "i_measured_planes",
30+
"nickname": "i_measured_planes",
31+
"description": "The measured planes (aka poses) to compare against the CAD planes.",
3232
"optional": false,
3333
"allowTreeAccess": true,
3434
"showTypeHints": true,

0 commit comments

Comments
 (0)