Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dimensionned surface3D (easy ones) #476

Open
wants to merge 18 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Arc: reverse
* BSplineCurve2D: offset
* Circle2D: bsplinecurve_intersections, point_distance
* Add dimensionned surface3D

### Fixed

Expand Down Expand Up @@ -58,7 +59,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* WiriMixin: from points: general method for Wire3D and 2D and for Contour2D and 3D.
* ConicalSurface3D, CylindricalSurface3D: plot method


### Fixed

* WireMixin: abscissa (add tolerance as parameter)
Expand Down
35 changes: 33 additions & 2 deletions volmdlr/faces.py
Original file line number Diff line number Diff line change
Expand Up @@ -1523,7 +1523,18 @@ def point2d_to_3d(self, point2d):
def point3d_to_2d(self, point3d):
return point3d.to_2d(self.frame.origin, self.frame.u, self.frame.v)

def dimensioned_surface2d(self, dimensionless_surface2d: Surface2D):
"""
Computes the dimentioned surface2D associated to the given parametric surface2d.
"""
return dimensionless_surface2d

def contour2d_to_3d(self, contour2d):
"""
Computes the 3D representation of a given contour2D.

:param contour2d: The given contour2D
"""
return contour2d.to_3d(self.frame.origin, self.frame.u, self.frame.v)

def contour3d_to_2d(self, contour3d):
Expand Down Expand Up @@ -1575,7 +1586,7 @@ class PeriodicalSurface(Surface3D):
"""
Abstract class for surfaces with two-pi periodicity that creates some problems.
"""

def face_from_contours3d(self, contours3d: List[volmdlr.wires.Contour3D], name: str = ""):
"""
Returns the face generated by a list of contours. Finds out which are outer or inner contours.
Expand Down Expand Up @@ -1711,7 +1722,15 @@ def linesegment3d_to_2d(self, linesegment3d):
end = volmdlr.Point2D(start.x, end.y)
return [vme.LineSegment2D(start, end)]

def arc3d_to_2d(self, arc3d):
def dimensioned_surface2d(self, dimensionless_surface2d: Surface2D):
"""
Computes the dimentioned surface2D associated to the given parametric surface2d.
"""
frame = volmdlr.OXY.copy()
frame.u = self.radius
return dimensionless_surface2d.frame_mapping(frame, side='old')

def arc3d_to_2d(self, arc3d: vme.Arc3D):
start = self.point3d_to_2d(arc3d.start)
end = self.point3d_to_2d(arc3d.end)

Expand Down Expand Up @@ -2327,6 +2346,12 @@ def point3d_to_2d(self, point3d):
phi = 0.0
return volmdlr.Point2D(theta, phi)

def dimensioned_surface2d(self, dimensionless_surface2d: Surface2D):
frame = volmdlr.OXY.copy()
frame.u = self.R
frame.v = self.r
return dimensionless_surface2d.frame_mapping(frame, side='old')

@classmethod
def from_step(cls, arguments, object_dict, **kwargs):
"""
Expand Down Expand Up @@ -3046,6 +3071,12 @@ def point3d_to_2d(self, point3d):

return volmdlr.Point2D(theta, phi)

def dimensioned_surface2d(self, dimensionless_surface2d: Surface2D):
frame = volmdlr.OXY.copy()
frame.u = self.radius
frame.v = self.radius
return dimensionless_surface2d.frame_mapping(frame, side='old')

def linesegment2d_to_3d(self, linesegment2d):
if linesegment2d.name == "construction":
return []
Expand Down