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

planar NURBS curve with weights <> 1.0 not evaluating in plane #7

Open
JochemvanderSpek opened this issue Sep 21, 2016 · 3 comments
Open

Comments

@JochemvanderSpek
Copy link

Hi,

I'm having serious difficulty understanding what is happening with a curve that has weights that are not 1.0. This code for generating a circle:

` double coeffs[ 36 ] = {
0.0, -radius, 0.1, 1.0,
-radius, -radius, 0.1, 0.707,
-radius, 0.0, 0.1, 1.0,
-radius, radius, 0.1, 0.707,
0.0, radius, 0.1, 1.0,
radius, radius, 0.1, 0.707,
radius, 0.0, 0.1, 1.0,
radius, -radius, 0.1, 0.707,
0.0, -radius, 0.1, 1.0
};
double knots[ 12 ] = {
0,
0,
0,
0.25,
0.25,
0.5,
0.5,
0.75,
0.75,
1,
1,
1
};

SISLCurve * curve = newCurve( 9, 3, knots, coeffs, 2, 3, 1 );`

produces this curve:

screen shot 2016-09-21 at 12 49 34

screen shot 2016-09-21 at 13 01 28

screen shot 2016-09-21 at 13 01 38

which is obviously not planar. tracing the code to s6ratder.c:161, it says:
gder[ki] = eder[ki] / w0;

which seems to suggest the position is divided by the weight, which results in coordinates that are not in the xy plane.

could anyone shed some light on this ?

thank you !

Jonathan

@tordokken
Copy link

Dear Jonathan,

In SISL the the weights are
are multiplied into the corfficient. So a vertex (x,y,w) is representer as (wx,wy,w).

So if you multiple you x and y with w I think it will work.

In the first version we only had B-spline, the approach above a representation in projective space made the introduction of NURBS very simple, only considering the rational representation when affisere coordinates were needed.

Tor

Sendt fra min iPhone

Den 21. sep. 2016 kl. 13.07 skrev JochemvanderSpek <[email protected]mailto:[email protected]>:

Hi,

I'm having serious difficulty understanding what is happening with a curve that has weights that are not 1.0. This code for generating a circle:

` double coeffs[ 36 ] = {
0.0, -radius, 0.1, 1.0,
-radius, -radius, 0.1, 0.707,
-radius, 0.0, 0.1, 1.0,
-radius, radius, 0.1, 0.707,
0.0, radius, 0.1, 1.0,
radius, radius, 0.1, 0.707,
radius, 0.0, 0.1, 1.0,
radius, -radius, 0.1, 0.707,
0.0, -radius, 0.1, 1.0
};
double knots[ 12 ] = {
0,
0,
0,
0.25,
0.25,
0.5,
0.5,
0.75,
0.75,
1,
1,
1
};

SISLCurve * curve = newCurve( 9, 3, knots, coeffs, 2, 3, 1 );`

produces this curve:

[screen shot 2016-09-21 at 12 49 34]https://cloud.githubusercontent.com/assets/16761743/18708501/619292c0-7ffb-11e6-95a4-1f21558edc09.png

[screen shot 2016-09-21 at 13 01 28]https://cloud.githubusercontent.com/assets/16761743/18708528/8e98e58a-7ffb-11e6-82b4-770860432e52.png

[screen shot 2016-09-21 at 13 01 38]https://cloud.githubusercontent.com/assets/16761743/18708533/939c5a58-7ffb-11e6-80ec-34f9d741ffad.png

which is obviously not planar. tracing the code to s6ratder.c:161, it says:
gder[ki] = eder[ki] / w0;

which seems to suggest the position is divided by the weight, which results in coordinates that are not in the xy plane.

could anyone shed some light on this ?

thank you !

Jonathan


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHubhttps://github.com//issues/7, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AEJws5Hvp-LOwOT0jbj7BXj2gb6-P5tuks5qsQ_JgaJpZM4KCrDH.

@JochemvanderSpek
Copy link
Author

allright, this was slightly surprising, but with some simple conversion functions I managed to keep things afloat. thanks !

@tordokken
Copy link

Dear Jochem,

This was a design decision taken 20 years ago based on efficiency of computations, that allows the denominator not be different from the other coordinates in most algorithms. We also store the projected coefficient in a array called rcoef (if I remember correctly).

Tor

From: JochemvanderSpek [mailto:[email protected]]
Sent: søndag 25. september 2016 22.35
To: SINTEF-Geometry/SISL [email protected]
Cc: Tor Dokken [email protected]; Comment [email protected]
Subject: Re: [SINTEF-Geometry/SISL] planar NURBS curve with weights <> 1.0 not evaluating in plane (#7)

allright, this was slightly surprising, but with some simple conversion functions I managed to keep things afloat. thanks !


You are receiving this because you commented.
Reply to this email directly, view it on GitHubhttps://github.com//issues/7#issuecomment-249445008, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AEJws3Ewt4pAORqWQ28zMJqZKackEZuKks5qttrcgaJpZM4KCrDH.

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

No branches or pull requests

2 participants