UV parameter

Hello,
in a script i want to find the plane on a surface with Rhino.surfaceFrame command, but i have to insert a U,V parameter.
So i wrote
SurfPlane = Rhino.SurfaceFrame(StrSurf, Array(1, 1))

(StrSurf is always a planar surface) so every where on the surfacethe normal is the same.
where can i find an explication of domain and U,V parameter of a point on a surface?

thank you!

The Domain of a curve is a mathematical term. It comes from the fact that a NURBS curve is defined by a mathematical function. The domain of a function is simply defined as "The set of all possible input values which will make the function ‘work’… "

https://www.intmath.com/functions-and-graphs/2a-domain-and-range.php

In the case of NURBS curves they are defined by “parameters” , the domain start is generally the smallest parameter in the range of the curve, and the domain end is the largest. (although curves can have reversed “negative direction” domains as well). The domain of a curve can be seen in Properties>Details, and is is also accessible via scripting.

A NURBS surface is defined by curves in two directions, U and V, thus a surface has both a U and V domain, each of which has a start and end parameter.

It is possible to ‘remap’ a curve or surface domain so that instead of going from some arbitrary number to some other arbitrary number, it goes from 0 to 1. This is practical for some purposes, as then a parameter of 0 represents the domain start, 0.5 the “mid-domain”, and 1.0 the domain end. This is called the “Normalized Parameter” in Rhino. Check the Rhinoscript help for the methods CurveNormalizedParameter and SurfaceNormalizedParameter.

So in your case, if you know the surface is planar, since a SurfacePlane method does not exist in Rhinoscript (only CurvePlane does), what you can do is get the surface’s plane or normal at “mid-domain”…

plane = Rhino.SurfaceFrame(srf, Rhino.SurfaceNormalizedParameter(srf, Array(0.5, 0.5)))
normal = Rhino.SurfaceNormal(srf, Rhino.SurfaceNormalizedParameter(srf, Array(0.5, 0.5)))

Using Python, one can go into RhinoCommon, where one has a TryGetPlane() method, which will return a plane if the surface or curve is planar.

1 Like

Some additional good reads:

https://developer.rhino3d.com/guides/rhinoscript/primer-101/7-geometry/

– Dale

1 Like