Surface.PointAt( u,v) from normailzed parameters

Hi All, I found a surface with this domain :
domain.Min =0 domain.Max = 0,000155249089128606
I have a list of normalized parameters and i want points at those values but something is wrong.
normalized u : 2,66362612419039E-05 corresponding U : 4,13525529559717E-09 ( domain.min :0 domain.max :0,000155249089128606
normalized u : 0,0555590862453079 corresponding U : 8,62549753240171E-06 ( domain.min :0 domain.max :0,000155249089128606
normalized u : 0,111099014551257 corresponding U : 1,72480208121684E-05 ( domain.min :0 domain.max :0,000155249089128606
normalized u : 0,166661882561978 corresponding U : 2,58741054602058E-05 ( domain.min :0 domain.max :0,000155249089128606
normalized u : 0,222239079886333 corresponding U : 3,45024147211327E-05 ( domain.min :0 domain.max :0,000155249089128606
normalized u : 0,277802545164206 corresponding U : 4,31285920943513E-05 ( domain.min :0 domain.max :0,000155249089128606
normalized u : 0,33337243953842 corresponding U : 5,17557675789209E-05 ( domain.min :0 domain.max :0,000155249089128606
normalized u : 0,388949399477794 corresponding U : 6,03840399860459E-05 ( domain.min :0 domain.max :0,000155249089128606
normalized u : 0,444498231212369 corresponding U : 6,90079455149968E-05 ( domain.min :0 domain.max :0,000155249089128606
normalized u : 0,500032508796312 corresponding U : 7,76295915253192E-05 ( domain.min :0 domain.max :0,000155249089128606
normalized u : 0,55556479200897 corresponding U : 8,6250927911316E-05 ( domain.min :0 domain.max :0,000155249089128606
normalized u : 0,611104135391084 corresponding U : 9,48733603821901E-05 ( domain.min :0 domain.max :0,000155249089128606
normalized u : 0,666667933381209 corresponding U : 0,000103499589408683 ( domain.min :0 domain.max :0,000155249089128606
normalized u : 0,722245114676254 corresponding U : 0,000112127896181074 ( domain.min :0 domain.max :0,000155249089128606
normalized u : 0,777808575785192 corresponding U : 0,000120754072907069 ( domain.min :0 domain.max :0,000155249089128606
normalized u : 0,833378449918733 corresponding U : 0,000129381245249293 ( domain.min :0 domain.max :0,000155249089128606
normalized u : 0,888954987902857 corresponding U : 0,000138009452148249 ( domain.min :0 domain.max :0,000155249089128606
normalized u : 0,944792147490955 corresponding U : 0,00014667812031383 ( domain.min :0 domain.max :0,000155249089128606
normalized u : 0,972397661654911 corresponding U : 0,000150963851242711 ( domain.min :0 domain.max :0,000155249089128606
normalized u : 0,0278049488788168 corresponding U : 4,31669298670376E-06 ( domain.min :0 domain.max :0,000155249089128606
normalized u : 0,0833560481936115 corresponding U : 1,29409505554184E-05 ( domain.min :0 domain.max :0,000155249089128606
normalized u : 0,1389011995298 corresponding U : 2,15642847058722E-05 ( domain.min :0 domain.max :0,000155249089128606
normalized u : 0,194454704553799 corresponding U : 3,01889157587494E-05 ( domain.min :0 domain.max :0,000155249089128606
normalized u : 0,250020339713639 corresponding U : 3,88154300041671E-05 ( domain.min :0 domain.max :0,000155249089128606
normalized u : 0,305583678755029 corresponding U : 4,74415877792868E-05 ( domain.min :0 domain.max :0,000155249089128606
normalized u : 0,361140410093686 corresponding U : 5,60667197145759E-05 ( domain.min :0 domain.max :0,000155249089128606
normalized u : 0,416695463853858 corresponding U : 6,46915912073334E-05 ( domain.min :0 domain.max :0,000155249089128606
normalized u : 0,472257298386973 corresponding U : 7,33175154089139E-05 ( domain.min :0 domain.max :0,000155249089128606
normalized u : 0,527808454082816 corresponding U : 8,19417817307349E-05 ( domain.min :0 domain.max :0,000155249089128606
normalized u : 0,583361640467805 corresponding U : 9,05663633151962E-05 ( domain.min :0 domain.max :0,000155249089128606
normalized u : 0,63890708609732 corresponding U : 9,91897431544208E-05 ( domain.min :0 domain.max :0,000155249089128606
normalized u : 0,694460674737398 corresponding U : 0,000107814387188618 ( domain.min :0 domain.max :0,000155249089128606
normalized u : 0,750026346482188 corresponding U : 0,000116440907113816 ( domain.min :0 domain.max :0,000155249089128606
normalized u : 0,805589700496319 corresponding U : 0,00012506706721344 ( domain.min :0 domain.max :0,000155249089128606
normalized u : 0,861146396118868 corresponding U : 0,000133692193603836 ( domain.min :0 domain.max :0,000155249089128606
normalized u : 0,916844484838738 corresponding U : 0,0001423392711438 ( domain.min :0 domain.max :0,000155249089128606
normalized u : 0,972448115736509 corresponding U : 0,000150971684192922 ( domain.min :0 domain.max :0,000155249089128606
normalized u : 0,0277521534571469 corresponding U : 4,30849654557935E-06 ( domain.min :0 domain.max :0,000155249089128606
normalized u : 0,0832230251958054 corresponding U : 1,29202988561758E-05 ( domain.min :0 domain.max :0,000155249089128606
normalized u : 0,138817640865783 corresponding U : 2,15513122993948E-05 ( domain.min :0 domain.max :0,000155249089128606
normalized u : 0,19451196565231 corresponding U : 3,01978054921358E-05 ( domain.min :0 domain.max :0,000155249089128606
normalized u : 0,250020167285948 corresponding U : 3,88154032349251E-05 ( domain.min :0 domain.max :0,000155249089128606
normalized u : 0,305525314376004 corresponding U : 4,74325267626056E-05 ( domain.min :0 domain.max :0,000155249089128606
normalized u : 0,361223426547033 corresponding U : 5,60796079433408E-05 ( domain.min :0 domain.max :0,000155249089128606
normalized u : 0,416829861487651 corresponding U : 6,47124563175608E-05 ( domain.min :0 domain.max :0,000155249089128606
normalized u : 0,472302506406566 corresponding U : 7,3324533912777E-05 ( domain.min :0 domain.max :0,000155249089128606
normalized u : 0,527760970827574 corresponding U : 8,19344099986097E-05 ( domain.min :0 domain.max :0,000155249089128606
normalized u : 0,583227660668823 corresponding U : 9,05455630734425E-05 ( domain.min :0 domain.max :0,000155249089128606
normalized u : 0,638823500683375 corresponding U : 9,91767665950413E-05 ( domain.min :0 domain.max :0,000155249089128606
normalized u : 0,694517926421921 corresponding U : 0,000107823275460491 ( domain.min :0 domain.max :0,000155249089128606
normalized u : 0,750026147178186 corresponding U : 0,000116440876172051 ( domain.min :0 domain.max :0,000155249089128606
normalized u : 0,805531341902209 corresponding U : 0,000125058007094862 ( domain.min :0 domain.max :0,000155249089128606
normalized u : 0,861229437507647 corresponding U : 0,000133705085703804 ( domain.min :0 domain.max :0,000155249089128606
normalized u : 0,916980517241296 corresponding U : 0,000142360390050389 ( domain.min :0 domain.max :0,000155249089128606
I get points obviously with Surface.PointAt(u,v) but all points are near the starting point. i think it is due to some tolerance. is there a way to fix it?

Hi @gianfranco74,

If you have a normalized parameter (where normalized means in the [0, 1] domain), and you want to evaluate a surface at this parameter, then you must convert the normalized parameter into a surface parameter, Interval.ParameterAt before calling Surface.PointAt.

var nu = 0.2; // normalized u
var nv = 0.3; // normalized v
var u = srf.Domain(0).ParameterAt(nu); // real u
var v = srf.Domain(0).ParameterAt(nv); // real v
var pt = srf.PointAt(u, v);

Does this help?

1 Like

Hi Dale. Yes exactly, infact I you use domain. parameterat(normalized parameter) to get parameter for srf. PointAt(u, v) and the result is all close to u =0

Sorry I saw that I did not attach the file 3dm, I forgot it. Do you need it to try it? I can send it tomorrow because now it is 12,30pm and the office is closed

Hi @gianfranco74,

This works:

protected override Result RunCommand(RhinoDoc doc, RunMode mode)
{
  var rc = RhinoGet.GetRectangle(out Point3d[] corners);
  if (rc != Result.Success)
    return rc;

  var plane = new Plane(corners[0], corners[1], corners[2]);
  var surface = new PlaneSurface(
    plane,
    new Interval(0.0, corners[0].DistanceTo(corners[1])),
    new Interval(0.0, corners[1].DistanceTo(corners[2]))
    );

  var norm_list = new double[] { 0.0, 0.25, 0.5, 0.75, 1.0 };
  foreach (var s in norm_list)
  {
    foreach (var t in norm_list)
    {
      var u = surface.Domain(0).ParameterAt(s);
      var v = surface.Domain(1).ParameterAt(t);
      var pt = surface.PointAt(u, v);
      doc.Objects.AddPoint(pt);
    }
  }

  doc.Objects.AddSurface(surface);
  doc.Views.Redraw();

  return Result.Success;
}

I guess we’ll need more details…

– Dale

1 Like

It is exactly what I do in my code, and it always works. With this surface, probably due to its domain(I think) , sometimes it gives wrong results. “sometimes” means that if I transform the surface sometimes it works, sometimes not.

Soved. It was a big problem to understand what was happening. There is nothing wrong in normalized parameter o PointAt or something else. It was a problem in my code. I’m sorry. Thanks to Dale for help.

1 Like