Skip to content

Commit

Permalink
Merge pull request #1170 from Dessia-tech/fix_plane_plane_intersections
Browse files Browse the repository at this point in the history
Fix: Plane3D.plane_intersections
  • Loading branch information
WirajanDASILVA authored Nov 30, 2023
2 parents d9f3bd8 + c1583b0 commit 2437225
Show file tree
Hide file tree
Showing 7 changed files with 359 additions and 52 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
#### surfaces.py
- ToroidalSurface3D: line_intersections, linesegment_intersections, plane_intersections
- ConicalSurface3D: circle_generatrixes direction.
- Plane3D: plane intersections.

#### faces.py
- ToroidalFace3D: PlaneFace3D intersections.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,195 @@
{
"object_class": "volmdlr.core.VolumeModel",
"name": "",
"primitives": [
{
"object_class": "volmdlr.faces.PlaneFace3D",
"name": "",
"surface3d": {
"object_class": "volmdlr.surfaces.Plane3D",
"name": "",
"frame": {
"object_class": "volmdlr.Frame3D",
"name": "",
"origin": {
"object_class": "volmdlr.Point3D",
"x": 59.6295,
"y": -3.80294619555,
"z": 3.24
},
"u": {
"object_class": "volmdlr.Vector3D",
"x": -0.823019109319956,
"y": 0.5680136844251079,
"z": 0.0
},
"v": {
"object_class": "volmdlr.Vector3D",
"x": -0.0,
"y": -0.0,
"z": -1.0
},
"w": {
"object_class": "volmdlr.Vector3D",
"x": -0.5680136844251079,
"y": -0.823019109319956,
"z": 0.0
}
}
},
"surface2d": {
"object_class": "volmdlr.surfaces.Surface2D",
"name": "name",
"outer_contour": {
"object_class": "volmdlr.wires.Contour2D",
"name": "",
"primitives": [
{
"object_class": "volmdlr.edges.LineSegment2D",
"name": "",
"start": {
"object_class": "volmdlr.Point2D",
"x": 0.0,
"y": 0.0
},
"end": {
"object_class": "volmdlr.Point2D",
"x": 13.390333073925845,
"y": 0.0
}
},
{
"object_class": "volmdlr.edges.LineSegment2D",
"name": "",
"start": {
"object_class": "volmdlr.Point2D",
"x": 13.390333073925845,
"y": 0.0
},
"end": {
"object_class": "volmdlr.Point2D",
"x": 13.390333073925845,
"y": 0.1
}
},
{
"object_class": "volmdlr.edges.LineSegment2D",
"name": "",
"start": {
"object_class": "volmdlr.Point2D",
"x": 13.390333073925845,
"y": 0.1
},
"end": {
"object_class": "volmdlr.Point2D",
"x": 0.0,
"y": 0.1
}
},
{
"object_class": "volmdlr.edges.LineSegment2D",
"name": "",
"start": {
"object_class": "volmdlr.Point2D",
"x": 0.0,
"y": 0.1
},
"end": {
"object_class": "volmdlr.Point2D",
"x": 0.0,
"y": 0.0
}
}
]
},
"inner_contours": []
},
"color": null,
"alpha": 1.0
},
{
"object_class": "volmdlr.faces.CylindricalFace3D",
"name": "",
"radius": 0.1,
"center": {
"object_class": "volmdlr.Point3D",
"x": 50.116598,
"y": 2.145056,
"z": 3.347
},
"normal": {
"object_class": "volmdlr.Vector3D",
"x": 0.0,
"y": 0.0,
"z": -1.0
},
"surface3d": {
"object_class": "volmdlr.surfaces.CylindricalSurface3D",
"name": "",
"frame": {
"object_class": "volmdlr.Frame3D",
"name": "",
"origin": {
"object_class": "volmdlr.Point3D",
"x": 50.116598,
"y": 2.145056,
"z": 3.347
},
"u": {
"object_class": "volmdlr.Vector3D",
"x": 1.0,
"y": 0.0,
"z": 0.0
},
"v": {
"object_class": "volmdlr.Vector3D",
"x": 0.0,
"y": -1.0,
"z": 0.0
},
"w": {
"object_class": "volmdlr.Vector3D",
"x": 0.0,
"y": 0.0,
"z": -1.0
}
},
"radius": 0.1
},
"surface2d": {
"object_class": "volmdlr.surfaces.Surface2D",
"name": "name",
"outer_contour": {
"object_class": "volmdlr.wires.ClosedPolygon2D",
"name": "",
"points": [
{
"object_class": "volmdlr.Point2D",
"x": 3.3717478808715387e-07,
"y": 0.0
},
{
"object_class": "volmdlr.Point2D",
"x": 3.141592653589793,
"y": 0.0
},
{
"object_class": "volmdlr.Point2D",
"x": 3.141592653589793,
"y": 0.4950000000000001
},
{
"object_class": "volmdlr.Point2D",
"x": 3.3717478808715387e-07,
"y": 0.4950000000000001
}
]
},
"inner_contours": []
},
"color": null,
"alpha": 1.0
}
],
"_references": {}
}
4 changes: 4 additions & 0 deletions tests/faces/test_planeface3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,10 @@ def test_cylindricalface_intersections(self):
face_intersections = plane_face_3.face_intersections(face)
self.assertEqual(face_intersections[0].primitives[0], edges.LineSegment3D(volmdlr.Point3D(0.0, 0.15, -0.25),
volmdlr.Point3D(0.0, 0.15, 0.25)))
"""======= [] ==========="""
planeface, cylface = dessia_common.core.DessiaObject.load_from_file(
os.path.join(folder, 'test_planeface_cylindricalface_intersections_none.json')).primitives
self.assertFalse(planeface.face_intersections(cylface))

def test_conical_face_intersections(self):
def get_face(plane, x1=-1, x2=1, y1=-1, y2=1):
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{
"object_class": "volmdlr.core.VolumeModel",
"name": "",
"primitives": [
{
"object_class": "volmdlr.surfaces.Plane3D",
"name": "",
"frame": {
"object_class": "volmdlr.Frame3D",
"name": "",
"origin": {
"object_class": "volmdlr.Point3D",
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"u": {
"object_class": "volmdlr.Vector3D",
"x": 1.0,
"y": 0.0,
"z": 0.0
},
"v": {
"object_class": "volmdlr.Vector3D",
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"w": {
"object_class": "volmdlr.Vector3D",
"x": 0.0,
"y": 0.0,
"z": 1.0
}
}
},
{
"object_class": "volmdlr.surfaces.Plane3D",
"name": "",
"frame": {
"object_class": "volmdlr.Frame3D",
"name": "",
"origin": {
"object_class": "volmdlr.Point3D",
"x": -0.06,
"y": 0.303510045726,
"z": -0.04
},
"u": {
"object_class": "volmdlr.Vector3D",
"x": -0.7071067811865476,
"y": 1.5492436747961248e-11,
"z": 0.7071067811865476
},
"v": {
"object_class": "volmdlr.Vector3D",
"x": -0.7071067811865476,
"y": 0.0,
"z": -0.7071067811865476
},
"w": {
"object_class": "volmdlr.Vector3D",
"x": -1.0954807081587062e-11,
"y": -1.0000000000000002,
"z": 1.0954807081587062e-11
}
}
}
],
"_references": {}
}
Loading

0 comments on commit 2437225

Please sign in to comment.