-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' into dimensioned_surfaces2d
- Loading branch information
Showing
9 changed files
with
577 additions
and
293 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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": "" | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
Oops, something went wrong.