PDA

View Full Version : identifying multiknots


4SweetB
12-18-2004, 02:52 PM
Hey all, I have a bit of a problem on a NURBS curve, and the docs haven't really helped..

I think I accidentally got a multiknot into this thing, but I'm having a devil of a time tracking it down. I've tried to get the status of each knot by selecting it and pressing Shift+Enter, but that doesn't seem to tell me the multiplicity. I've also tried deleting each knot to see if it's the one, but irrespective, deleting a knot wildly moves the CVs to make up for it, so it's really hard to tell.

I know, I should just start the thing over, but I already have model relationships on it, and besides, I'd like to know how to fix this in future rather than just keep doing everything the hard way.

The reason I think there is a multiknot is that the resulting surface will have two isoparms rather close together that I can't get separated.. makes me feel kinda stupid to knot know which knot is knot right, but, hey, there should be a way....

Do I hafta stop, figure out the XSI object model, and write a script to automatically select any knot with multiplicity > 1, or is there some more straightforward way of determining this?

(I'm pretty sure the answer will make me feel dumb, lol.)

Thanks,
Kevin

4SweetB
12-19-2004, 03:36 AM
This problem drove me sufficiently crazy that I wrote a script, which I've included below. (Obviously provided with no warranties, lol.) It selects all the knots in a NURBS curve that have multiplicity above one. Incidentally, this is always true of the first knot, and never of the last, no matter what you do.

The script doesn't work either on a closed curve or on a curve that has ever BEEN closed (unless you delete the close operators). If anyone understands why, please do tell! (The internal knot indices stop matching the user interface ones, but I don't know why.) It also doesn't work if the curve has less than 5 CVs.

After spending quite some time shouting at the computer like a madman, I have finally come to the conclusion that either I've just lost my mind or XSI may subtly (but maddeningly) corrupt curves over time in much the same fashion as Windows 98 corrupts itself over time. If your NURBS surface (based on curves) looks a bit off and you can't figure out why (or if there is a knot curve where you think there shouldn't be one), I'd recommend the following:

1. Run the script below and pick the relevant curve. If only the first knot and any you intended to be multiknots get selected, then the curve is okay.

2. If any *other* knots show up selected (and you don't have a close curve operator on the stack), then turn on NURBS hulls on unselected objects, unselect it, and start drawing a new curve over top of it. If it's planar and you draw with CVs, you should be able to pretty easily recreate it the same.

3. Now NUKE THE THING!!! (At least in my opinion) the curve has become so fatally corrupted that no amount of deleting knots and re-adding CVs or even freezing it is going to make it behave right.

After I did this and rebuilt the surface, it looked fine and all the isoparms were in the expected places.

Hopefully this corruption is a rare occurrence. I can't really identify what it is that I did to this one to get it so screwed up, but I had several other curves in the scene quite a bit more complex (where I had the hull crossing itself in a number of places to get nice microbevelled edges) that didn't seem to corrupt themselves like this one did. And btw, they passed the test that the script should only select the first point.

If anyone has any additional insight, I'd LOVE to hear it; I've just recently gotten into XSI, and NURBS, so this could possibly be a case of my confusing the ???? out of myself, but I *did* get the desired results after heeding this, so maybe there's something to it.

Cheers,
Kevin

// find_multiknots.js
// On a good day, this script will select the multiknots in a
// curve. It's not a good day if the curve has ever been closed.
// Uncomment the two extra lines to get some diagnostic info.

var button;
var ret = PickElement( siCurveFilter, "Pick curve", "", button, 2 );
button = ret.Value("ButtonPressed");

if( button != 0 )
{
var x3dobj = ret.Value("PickedElement");
var knotcoll = x3dobj.ActivePrimitive.Geometry.Curves(0).Knots;
var knotcount = knotcoll.Count;

DeselectAll();
SetSelFilter("Knot");

//logmessage("degree="+knotcoll.Degree );

var name = x3dobj.Name;
var i;

for( i = 0 ; i < knotcount ; i++ )
{
//logmessage( i + "=" + knotcoll.GetMultiplicity(i) );

if( knotcoll.GetMultiplicity(i) > 1 )
AddToSelection( name + ".knot[" + i + "]" );
}
}

CGTalk Moderation
01-20-2006, 04:00 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.