vcanim.gif (8357 bytes)SAA_nurbsSurfaceSplit
Home ] Sales ] Products ] Services ] Support ] Downloads ]

 

 


SAA_nurbsSurfaceSplit

Splits a closed NURBS surface into a new NURBS surface that is open at the split point.

Splits an open NURBS surface into two new NURBS surfaces.

SAA_nurbsSurfaceSplit pscn pelmSrf gtype iShape dir dVal nSrfNew pelmSrfNew

pelmSrf

A NURBS surface. Use SAA_AllocElem to allocate it.

geomtype

Specifies what geometry you want to work with:

  • SAA_GEOM_ORIGINAL for the original, non-deformed geometry.
  • SAA_GEOM_DEFORMED for deformed geometry (if any deformations, such as lattice, curve, surface, wave, qstretch, flexible envelope, or other custom effects, are applied to the model). To check if a model is deformed, use SAA_modelIsDeformed().
  • SAA_GEOM_SHAPE to access shapes (the shapeid argument specifies which shape).

Use global array SAA_Constants to get actual values of the constants, for example $SAA_Constants(SAA_GEOM_ORIGINAL).

shapeid

Identifies the shape if the geometry type is SAA_GEOM_SHAPE. To get the shape identifiers, use SAA_modelGetNbShapes().

dir

Specifies whether to split the surface in the U direction or the V direction.

  • SAA_U_DIRECTION
  • SAA_V_DIRECTION

dVal

Knot value at which to split the surface.

nSrfNew

Number of new NURBS surfaces. If pelmSrf is closed in the specified direction, nSrfNew is 1. Otherwise, if pelmSrf is open, nSrfNew is 2.

pelmSrfNew

Returns the new NURBS surfaces. Use SAA_AllocElem to allocate it.

Possible Errors

  • SI_ERR_WRONG_COUNT if nSrfNew does not match the actual number of new surfaces created by the split. Extra surfaces pointed to by pelmSrfNew are marked as invalid.

See Also

Example

This code fragment shows how to bisect a NURBS surface.

proc SAA_nurbsSurfaceSplitExample {} {

    global SAA_Constants
   
    set scene [SAA_AllocScene]

    SAA_sceneGetCurrent $scene

    package require SW

    set surface [SW_name2Element grid1 $scene]

    SAA_nurbsSurfaceGetClosed $scene $surface closed0 closed1

    SAA_nurbsSurfaceGetNbKnots $scene $surface nbKnots0 nbKnots1

    set knots0 [SAA_AllocDouble $nbKnots0]

    set knots1 [SAA_AllocDouble $nbKnots1]

    SAA_nurbsSurfaceGetKnots $scene $surface $SAA_Constants(SAA_GEOM_DEFORMED) \
        0 $nbKnots0 $nbKnots1 $knots0 $knots1

    set dval [expr ([access $knots0 0] + [access $knots0 [expr  $nbKnots0 - 1]]) / 2]

    if { $closed0 == 0 } {

        set nSrfNew 2
    } else {

        set nSrfNew 1
    }

    set newSurfaces [SAA_AllocElem $nSrfNew]

    SAA_nurbsSurfaceSplit $scene $surface $SAA_Constants(SAA_GEOM_DEFORMED) \
        0 $SAA_Constants(SAA_U_DIRECTION) $dval $nSrfNew $newSurfaces

    foreach item "$scene $surface $knots0 $knots1 $newSurfaces" {

        SAA_Free $item
    }

}


SAA Index ] Examples SAA calls index ]

copyright Video-Collage Inc.