# How to achieve a nurbs quadball in rhino?

[quote=“chuck, post:11, topic:5244, full:true”] I also haven’t convinced myself that it is possible to get a perfect sphere this way, although it seems likely.
[/quote]

yeah, i can’t get a perfect sphere and my version is a weightier surface than the ones you guys are doing…

if i extract some of the isocurves then randomly measure to the cpoint, i’m still getting a slight variance… not sure if my tolerance settings have anything to do with it but i imagine so?

the only way i’ve been able to make a perfect sphere is to span an arc diagonally across a box then revolve it… then trim it with the red arcs shown in my original picture… but then there’s a seam in the surface… and it’s trimmed

Try this for the middle weight…
0.46796046944844725617756511770484

I was being foolish. If the side cvs have weight w, then the end weights of the middle isocurve would be (1+w)/2, and the middle weight of the middle isocurve would be wm = sqrt(2)/2*(1+w)/2. This means if b = middle surface cv weight, then (w+b)/2 = wm. Put this all together and we get the srf’s center weight is sqrt(2)/2*(sqrt(2/3)+1) - sqrt(2/3). If I did the arithmetic and algebra right, this is the only thing that could work.

Eyballing, I get an angle of 59.8, so you are probably right that 60 is correct.

Hi Jeff,

Yes, I think the tolerance is what you are seeing. Generally when you want to get a sphere, it is best to avoid anything that involves tolerance. By adding patches you can get arbitrarily close, but without going to the limit (infinitely many patches) you can never get there, unless you start with an exact mathematical solution.

right, but the software should be handling that aspect for me, right?

i don’t know, i’ll be surprised if anybody can mathematically figure out where to place control points and arrive at a solution which is closer than the one i’ve put up…

(that said, i’m not even sure if my solution fits the original criteria of "2 degree 3 CV count in both U and V direction (a 2 degree bezier surface),and the result should be a rational nurbs sphere."
as in-- does the 3 CV include the surface edges as 2 of the 3?

Empirically in my file I arrived at 0.467991, so I was pretty close…!

I would really like it to be a round number like that, but what I get is more like 59.846 - 60.000 does not work…

Unfortunately, as Jeff also saw, the sections through the patch are not perfect and will not simplify to arcs within the file tolerance… I don’t know if you can get closer, it seems this will always be an “approximate” solution.

–Mitch

From properties:
`Surface NURBS Surface (rational) "U": degree =2 CV count = 3 (0.000 <= U <= 106.604) "V": degree =2 CV count = 3 (0.000 <= V <= 106.604)`
–Mitch

I just noticed that the Weight command only uses 5 significant digits. Maybe that’s where the error comes from. I have to leave this alone for now, but I’ll look again when I have a chance. I know how to determine the exact solution if there is one. Now that the weights are determined, there is a formula for the necessary location of the cv. If that location doesn’t give a sphere, then we can just come close.

Chuck

Well, thanks for "weighing in"on this Chuck, interesting excercise !

–Mitch

Fun stuff. It sure beats working on STEP import.

ah… ok… the surface i was making is:

NURBS Surface
"U": degree =3 CV count = 7 (0.000 <= U <= 12.087)
“V”: degree =3 CV count = 7 (0.000 <= V <= 12.087)

I remember I read of a paper about such an object years ago, it was a true sphere but IIRC the surfaces had degree 4.
I was not able to get the text because an ACM login was needed (or something like that)

Ok, I had to finish this. It’s the geek in me. I couldn’t get this using rhino commands. I had to write a test command and use our low level stuff.QuadSphere.3dm (91.9 KB) It’s not perfect because I used an overly computational method. I’ll figure out the exact solution some day. Mitch, yours is almost identical to this.

Chuck

1 Like

one way to get the height of that point (or to get the same surface) using only rhino is to use the setup arcs that mitch is using (the red ones in the first drawing i posted) then span a single arc across the midpoint… then use sweep2 - simple sweep…

hmm… actually, that exposes a very slight error in simple sweep2…

the middle control point i get when doing it that way is at:
-2.33688e-14, 0, 2.37069

whereas the version you (chuck) posted is at
0, 0, 2.37069

so while the height is showing the same, my version has shifted ever so slightly on the X axis…

Looks like simple sweep uses the same low level code that I did, except it must do some other calculations to set things up. That’s where your numerical noise is coming from. Most likely from calculating the weights for the middle points on the sides. I already knew what they needed to be.

Chuck

[quote=“chuck, post:27, topic:5244, full:true”]… the weights for the middle points on the sides. I already knew what they needed to be.
[/quote]

not me… i still don’t.

i just know (some of) the geometric games which should arrive at the proper solutions then count on you guys to handle the geek stuff under_the_hood / out_of_sight

so just keep on doing whatever it is you all are doing

I used EdgeSrf from the arcs, it preserves the control point structure and weights from the input curves. Unfortunately it doesn’t know what to do in the middle, so it makes a very flat curved surface - but all that needs adjusting at that point is the middle CV vertical location and weight (all the others are already set correctly).

I ended up doing that by eye to a reference arc in an orthographic view, the weight affects the flatness of the surface curve, so it’s adjust the weight, nudge the control point so the apex is correct, compare along the arc, adjust, nudge, compare, etc… in the end I think I reached the limits of the display accuracy.

I had tried simple sweep2 but it didn’t work originally (that was one of my first ideas) but now I tried it and it is working… It looks slightly better than my handmade one and a lot less effort…

–Mitch

Thanks for you guys answers. @chuck where can I learn the way you calculate the weight? very cool.

I’m a rhino enthusiast，here is my new post about a similar question. link

are you seeing the same tiny deviation of the center control point in the x or y axis? the version i did was off by -2.33688e-14mm …i didn’t think rhino could even deal with or display measurements that small.
?

Mine said “0” but my model was bigger than yours…
– or maybe my Rhino is better behaved…

Anyway, `XXXXXe-14` IS zero for all intents and purposes, it’s just floating point “fuzz”…

–Mitch