PDA

View Full Version : Smoothing angles



regularfry
08-31-2006, 04:53 AM
I'm trying to get surface information in Layout. This doesn't seem to work:



LWSurfaceID surf_id;
int result;
double angle;

surf_id = surff->byName(surf_name, object_name);
angle = *(surff->getFlt(surf_id, SURF_SMAN));
result = (angle != 0.0f);


The value of angle always comes back as 0.0, no matter what the smothing threshold on the surface is set to. Any ideas why?

Pomfried
08-31-2006, 09:42 AM
Ok, two things are wrong there :D

The first problem is that you have to change
LWSurfaceID surf_id; to
LWSurfaceID *surf_id;
and then the second thing you have to consider is that the byName function returns a pointer to an array of surfaces with the given name.
So you either have to use this line of code:

angle = *(surff->getFlt(surf_id[0], SURF_SMAN));
or you could use some other way of getting the SurfaceID (there's an example in the SDK, the "box" example shows you how to create a list of the surfaces and some functions used as callbacks).

regularfry
08-31-2006, 10:44 AM
It would appear I've been staring at the same code for too long. Again. Where's that "slaps forehead with palm" smiley when you need it? :)

Pomfried
08-31-2006, 11:15 AM
:foreheads there? :D