SilverScreen Solid Modeler

prim_facets_collect

prim_facets_collect

Previous topic Next topic  

prim_facets_collect

Previous topic Next topic JavaScript is required for the print function  

 

SilverScreenAPI

 

SS_FACET_HANDLE prim_facets_collect(OBJECT_NODE *obj, PRIM_NODE *prim)

 

 

OBJECT_NODE *obj;   // A pointer to the OBJECT_NODE parent of prim

PRIM_NODE   *prim;  // A pointer to a PRIM_NODE

 

 




Synopsis

#include "silver.h"

#include "ssnodes.h"

 

The prim_facets_collect function facets a primitive, that is it represents a primitive by an approximation of lines.

 

 

Parameters

obj is the object entity that contains prim

prim is the primitive that is to be faceted

 

 

Return Value

prim_facets_collect returns a handle that can be used to retrieve information about prim's facets if successful, otherwise it returns NULL

 

 

Remarks

You must call prim_facets_release with a handle you obtained from prim_facets_collect when you are finished with it. If the primitive has holes, those facets will also be retrieved.

 

 

See Also

prim_facet_get, prim_facets_release, prim_facets_count

 

 

Example

The following example allows the user to select a circle from the current drawing, then generates an object with a prefix of "facet" in the root block that contains the circles facets:

C / C++ Code

 

 #include "silver.h"

 #include "ssnodes.h"

 

 

 void main(void)

    {

    char              prim_path[512];

    OBJECT_NODE       *obj;

    PRIM_NODE         *prim;

    SS_FACET_HANDLE   fh;

    SS_FACET_INFO     fi;

    int               i;

 

 

    if ( ! pick_primitive("Select a circle to facet",

                           BITS_CIRCLE, prim_path) )

       exit(-1);

 

    prim = get_prim(prim_path, &obj);

 

    if ( fh = prim_facets_collect(obj, prim) )

       {

       ss_command("goto block \\");

       ss_command("create object facet*");

 

       ss_command("pen current color light-red linestyle solid width 1");

 

       for (i = 1; i <= prim_facets_count(fh); i++)

          {

          if ( prim_facet_get(fh, i, &fi) )

             {

             // Create the facet lines

 

             ss_command("draw line %z %z", &fi.points[0], &fi.points[1]);

             }

          }

 

       prim_facets_release(fh);

       }

    }