Skip to content

Commit

Permalink
Merge branch 'dev' into dimensioned_surfaces2d
Browse files Browse the repository at this point in the history
  • Loading branch information
masfaraud authored Dec 15, 2022
2 parents d47ec63 + beccd6b commit a4d1530
Show file tree
Hide file tree
Showing 9 changed files with 577 additions and 293 deletions.
24 changes: 11 additions & 13 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Ellipse2D.tranlation()
* Ellipse2D.frame_mapping()
* Line2D.frame_mapping()
* Arc2D: cut_betweeen_two_points
* Contour3D: linesegment_intersections, line_intersections
* Circle3D: primitives: [Arc3D, Arc3D], get_primitives, abscissa, linesegment_intersections
* Arc3D: line_intersections, linesegment_intersections
* new module utils: intersections -> circle_3d_linesegment_intersections
* Ellipse3D: point_belongs, abscissa, length, to_2d
* CylindricalSurface3D: point_on_surface, is_coincident, arcellipse3d_to_2d


### Fixed

* Contour2D: point_belongs
Expand All @@ -78,7 +81,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* ArcEllipse2D: to_3d
* Fix boolean operations when faces are 100% coincident
* Fix some to_step methods from edges.py and faces.py
* Linesegment2D: infinite_primitive
* Arc2D: point_belongs
* Arc2D: infinite_primitive
* Wire2D: infinite_intersections
* infinite primitive offset of linesegment
* Ellispe3D: discretization_points

### Performance improvements

Expand All @@ -88,6 +96,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Refactorings
* LineSegment3D: intersections
* Line2D: sort_points_along_line
* Line3D: intersections


### Unittests
Expand Down Expand Up @@ -122,10 +131,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Ellipse2D.tranlation()
* Ellipse2D.frame_mapping()
* Line2D.frame_mapping()
* Contour2D: offset
* ArcEllipse3D.to_2d()
* Circle3D: point_belongs
* Circle3D: discretization_points
* Arc3D: line_intersections, linesegment_intersections
* Ellipse3D: point_belongs, abscissa, length, to_2d, discretization_points
* CylindricalSurface3D: point_on_surface, is_coincident

## v0.6.1 [12/13/2022]
Expand Down Expand Up @@ -174,25 +185,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Contour2D: point_belongs (bug when contour has only one primitive, like FullArc2D)
* Contour: contours_from_edges
* PlaneFace3D: face_intersections
<<<<<<< HEAD
=======
<<<<<<< HEAD
<<<<<<< HEAD
>>>>>>> testing
* Edge: insert_knots_and_mutiplicity
* BSplineCurve3D: from_step
* Surface2D: cut_by_line
* Circle3D: to_step
<<<<<<< HEAD
=======
* ArcEllipse3D.to_2d()

=======
* infinite primitive offset of linesegment
>>>>>>> master
=======
>>>>>>> master
>>>>>>> testing

### Performance improvements

Expand Down
4 changes: 2 additions & 2 deletions code_pydocstyle.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
'D202': 1,
'D203': 1,
'D204': 1,
'D205': 279,
'D205': 271,
'D206': 1,
'D207': 1,
'D208': 7,
Expand All @@ -49,7 +49,7 @@
'D301': 1,
'D302': 1,

'D400': 418,
'D400': 407,
'D401': 1,
'D402': 1,
'D403': 114,
Expand Down
235 changes: 235 additions & 0 deletions tests/wires/contour_to_offset.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,235 @@
{
"name": "",
"object_class": "volmdlr.wires.Contour2D",
"package_version": "0.6.1.dev420+g2c11c1cb",
"primitives": [
{
"name": "",
"object_class": "volmdlr.edges.Arc2D",
"package_version": "0.6.1.dev420+g2c11c1cb",
"start": {
"object_class": "volmdlr.Point2D",
"x": 10.0,
"y": -0.6,
"name": ""
},
"end": {
"object_class": "volmdlr.Point2D",
"x": 12.0,
"y": 1.4,
"name": ""
},
"interior": {
"object_class": "volmdlr.Point2D",
"x": 11.414213562373096,
"y": -0.014213562373095234,
"name": ""
},
"angle1": -1.5707963267948974,
"angle2": -1.1102230246251575e-15
},
{
"object_class": "volmdlr.edges.LineSegment2D",
"name": "",
"start": {
"object_class": "volmdlr.Point2D",
"x": 12.0,
"y": 1.4,
"name": ""
},
"end": {
"object_class": "volmdlr.Point2D",
"x": 12.0,
"y": 9.4,
"name": ""
}
},
{
"object_class": "volmdlr.edges.LineSegment2D",
"name": "",
"start": {
"object_class": "volmdlr.Point2D",
"x": 12.0,
"y": 9.4,
"name": ""
},
"end": {
"object_class": "volmdlr.Point2D",
"x": 9.5,
"y": 9.4,
"name": ""
}
},
{
"object_class": "volmdlr.edges.LineSegment2D",
"name": "",
"start": {
"object_class": "volmdlr.Point2D",
"x": 9.5,
"y": 9.4,
"name": ""
},
"end": {
"object_class": "volmdlr.Point2D",
"x": 9.5,
"y": 1.1,
"name": ""
}
},
{
"name": "",
"object_class": "volmdlr.edges.Arc2D",
"package_version": "0.6.1.dev420+g2c11c1cb",
"start": {
"object_class": "volmdlr.Point2D",
"x": 9.5,
"y": 1.1,
"name": ""
},
"end": {
"object_class": "volmdlr.Point2D",
"x": 9.0,
"y": 0.6,
"name": ""
},
"interior": {
"object_class": "volmdlr.Point2D",
"x": 9.353553390593273,
"y": 0.7464466094067264,
"name": ""
},
"angle1": -1.5707963267948575,
"angle2": -3.8191672047103896e-14
},
{
"object_class": "volmdlr.edges.LineSegment2D",
"name": "",
"start": {
"object_class": "volmdlr.Point2D",
"x": 9.0,
"y": 0.6,
"name": ""
},
"end": {
"object_class": "volmdlr.Point2D",
"x": -10.0,
"y": 0.6,
"name": ""
}
},
{
"name": "",
"object_class": "volmdlr.edges.Arc2D",
"package_version": "0.6.1.dev420+g2c11c1cb",
"start": {
"object_class": "volmdlr.Point2D",
"x": -10.0,
"y": 0.6,
"name": ""
},
"end": {
"object_class": "volmdlr.Point2D",
"x": -12.0,
"y": -1.4,
"name": ""
},
"interior": {
"object_class": "volmdlr.Point2D",
"x": -11.414213562373096,
"y": 0.014213562373095234,
"name": ""
},
"angle1": 1.5707963267948957,
"angle2": 3.141592653589792
},
{
"object_class": "volmdlr.edges.LineSegment2D",
"name": "",
"start": {
"object_class": "volmdlr.Point2D",
"x": -12.0,
"y": -1.4,
"name": ""
},
"end": {
"object_class": "volmdlr.Point2D",
"x": -12.0,
"y": -19.6,
"name": ""
}
},
{
"object_class": "volmdlr.edges.LineSegment2D",
"name": "",
"start": {
"object_class": "volmdlr.Point2D",
"x": -12.0,
"y": -19.6,
"name": ""
},
"end": {
"object_class": "volmdlr.Point2D",
"x": -10.8,
"y": -19.6,
"name": ""
}
},
{
"object_class": "volmdlr.edges.LineSegment2D",
"name": "",
"start": {
"object_class": "volmdlr.Point2D",
"x": -10.8,
"y": -19.6,
"name": ""
},
"end": {
"object_class": "volmdlr.Point2D",
"x": -10.8,
"y": -1.1,
"name": ""
}
},
{
"name": "",
"object_class": "volmdlr.edges.Arc2D",
"package_version": "0.6.1.dev420+g2c11c1cb",
"start": {
"object_class": "volmdlr.Point2D",
"x": -10.8,
"y": -1.1,
"name": ""
},
"end": {
"object_class": "volmdlr.Point2D",
"x": -10.3,
"y": -0.6,
"name": ""
},
"interior": {
"object_class": "volmdlr.Point2D",
"x": -10.65355339,
"y": -0.7464466,
"name": ""
},
"angle1": 1.570796296703869,
"angle2": -3.1415926234987612
},
{
"object_class": "volmdlr.edges.LineSegment2D",
"name": "",
"start": {
"object_class": "volmdlr.Point2D",
"x": -10.3,
"y": -0.6,
"name": ""
},
"end": {
"object_class": "volmdlr.Point2D",
"x": 10.0,
"y": -0.6,
"name": ""
}
}
]
}
9 changes: 8 additions & 1 deletion tests/wires/test_contour2d.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import unittest

import dessia_common
import volmdlr
from volmdlr.models.contours import contour2d_1, contour2d_2
from volmdlr import wires, edges
Expand All @@ -25,6 +26,12 @@ def point_belongs(self):
def test_cut_by_wire(self):
pass

def test_offset(self):
contour_to_offset = dessia_common.DessiaObject.load_from_file('wires/contour_to_offset.json')
stringer_contour_offset = contour_to_offset.offset(4)
self.assertEqual(len(stringer_contour_offset.primitives), 10)
self.assertAlmostEqual(stringer_contour_offset.area(), 546.1486677646163)


if __name__ == '__main__':
unittest.main()
unittest.main()
46 changes: 46 additions & 0 deletions tests/wires/test_ellipse3d.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import unittest
import volmdlr
from volmdlr import wires


class TestEllipse3D(unittest.TestCase):
ellipse = wires.Ellipse3D(4, 3, volmdlr.O3D, volmdlr.Z3D, volmdlr.X3D)

def test_point_belongs(self):
point_on_ellipse = volmdlr.Point3D(2.8284271247461903, 2.1213203435596424, 0)
point_on_ellipse2 = volmdlr.Point3D(4, 0, 0)
point_not_on_ellipse = volmdlr.Point3D(3, 3, 0)
self.assertTrue(self.ellipse.point_belongs(point_on_ellipse))
self.assertTrue(self.ellipse.point_belongs(point_on_ellipse2))
self.assertFalse(self.ellipse.point_belongs(point_not_on_ellipse))

def test_length(self):
self.assertAlmostEqual(self.ellipse.length(), 22.1034921607)

def test_discretization_points(self):
discretization_points = self.ellipse.discretization_points(number_points=4)
expected_points = [volmdlr.Point3D(4.0, 0.0, 0.0),
volmdlr.Point3D(0, -3, 0),
volmdlr.Point3D(-4, 0, 0),
volmdlr.Point3D(0, 3, 0)]
for expected_point, point in zip(expected_points, discretization_points):
self.assertEqual(expected_point, point)

def test_to_2d(self):
vector_2 = self.ellipse.normal.cross(self.ellipse.major_dir)
ellipse_2d = self.ellipse.to_2d(self.ellipse.center, self.ellipse.major_dir, vector_2)
self.assertEqual(volmdlr.O2D, ellipse_2d.center)
self.assertEqual(volmdlr.X2D, ellipse_2d.major_dir)

def test_abscissa(self):
point_on_ellipse = volmdlr.Point3D(2.8284271247461903, 2.1213203435596424, 0)
point_on_ellipse2 = volmdlr.Point3D(4, 0, 0)
point_not_on_ellipse = volmdlr.Point3D(3, 3, 0)
self.assertAlmostEqual(self.ellipse.abscissa(point_on_ellipse), 2.022137530)
self.assertAlmostEqual(self.ellipse.abscissa(point_on_ellipse2), 22.1034921607)
with self.assertRaises(ValueError):
self.ellipse.abscissa(point_not_on_ellipse)


if __name__ == '__main__':
unittest.main()
Loading

0 comments on commit a4d1530

Please sign in to comment.