Skip to content

Conversation

@robin-oval
Copy link
Contributor

Rhino curve and surface functions
curve length and is_closed
surface kinks, closest_point, closest_point_on_boundary and several mapping/remapping functions between XYZ and UV(0) spaces based on the surface's parameterisation

Copy link
Member

@tomvanmele tomvanmele left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should avoid just providing wrappers to the corresponding rs.xxx functions and use RhinoCommon object methods where possible...

it is not entirely clear what some of the functions actually do, so examples and more explanations are necessary...

The curve's length.
"""
return rs.CurveLength(self.guid)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the object is also stored, and there is a method of the object for getting the length...
https://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_Geometry_Curve_GetLength_2.htm

"""

return rs.IsCurveClosed(self.guid)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The list of XYZ coordinates of surface boundary kinks.
"""

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove empty line

"""

borders = self.borders(type = 0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spaces

borders = self.borders(type = 0)
proj_dist = {tuple(proj_xyz): distance_point_point(xyz, proj_xyz) for proj_xyz in [RhinoCurve(border).closest_point(xyz) for border in borders]}
delete_objects(borders)
return min(proj_dist, key = proj_dist.get)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spaces

The XYZ coordinates of the re-mapped point.
"""

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blank line

The XYZ coordinates of the closest point on the boundaries of the surface.
"""

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blank line

The XYZ coordinates of the closest point on the surface.
"""

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blank line


return rs.SurfaceClosestPoint(self.guid, xyz) + (0.,)

def remap_xyz_point(self, uv):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

example?

Parameters
----------
uv : list
List of UV(0) coordinates.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UV(0)

@robin-oval
Copy link
Contributor Author

instead of wrapping rhinoscriptsyntax functions, is it better to wrap RhinoCommon functions or not wrapping anything and calling RhinoCommon methods directly?

@tomvanmele tomvanmele merged commit b7fab86 into compas-dev:master Mar 14, 2019
@robin-oval robin-oval deleted the feature/rhino_object_functions branch March 14, 2019 12:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants