SINTEF-Geometry / SISL

The SINTEF Spline Library
GNU Affero General Public License v3.0
177 stars 60 forks source link

Approximate a sphere (rational surface) as a B-spline (non-rational) surface #11

Open vlopez10 opened 6 years ago

vlopez10 commented 6 years ago

I have tried to approximate a sphere with a B-spline surface using the s1365 function as indicated in the manual.

In one parametric direction it seems to work properly, but not in the other. Any suggestions? Thank you.

/////////////// center[ 0 ] = center[ 1 ] = center[ 2 ] = 0.0; axis[ 0 ] = 0.0; axis[ 1 ] = 0.0; axis[ 2 ] = 1.0; equator[ 0 ] = 0.0; equator[ 1 ] = 10.0; equator[ 2 ] = 0.0; _GetSISL( )->s1023( center, axis, equator, 2, 4, &surface2, &stat ); if ( stat < 0 ) return false; _GetSISL( )->freeSurf( Surface ); Surface = surface2;

    _GetSISL( )->s1365( Surface, 0.0, 0.01, 0.0, Surface->idim, &surface2, &stat );
    if ( stat < 0 ) return false;
    _GetSISL( )->freeSurf( Surface );
    Surface = surface2;

////////////// image image

VibekeSkytt commented 6 years ago

You might have hit a problem with the offset functionality. Does your final surface have more coefficient that the rational one in one parameter direction, but not in the other? Unfortunately, I am not able to look at it now. If you want to create a non-rational spline sphere, an alternative approach could be to use s1303 to create an approximation to a half circle and then use s1302 to rotate this curve around the axis going through the endpoints of the half circle.

Vibeke

vlopez10 commented 6 years ago

Thanks you for the reply.

Our objetive is to aproximate a sphere, not to create it.

The problem appears in the function s1365 of calculating the offset of a surface, when calculating edge curves for the rational surface corresponding to the sphere.

In one of the parametric directions, the two edge curves are degenerated into a single point. There is not enough data in that parametric direction.

If we construct a curve of a single point for the degenerate edge curves, and add in that case a further intermediate curve, it is possible to adequately construct a non-rational approximation of the sphere.

I have implemented the solution and it works well. If they are interested in the solution and consider it appropriate, it would not be inconvenient to send it.

Thanks again and regards.

Vicente López.