ShapeOp
0.1.0

#include "Common.h"
Go to the source code of this file.
Typedefs  
typedef struct ShapeOpSolver  ShapeOpSolver 
C structure that containts the C++ ShapeOp::Solver.  
typedef enum shapeop_err  shapeop_err 
ShapeOp Success and Error type. This list might be extended. To simply test for errors, use =! SO_SUCCESS.  
Enumerations  
enum  shapeop_err { SO_SUCCESS = 0, SO_INVALID_CONSTRAINT_TYPE = 1, SO_INVALID_ARGUMENT_LENGTH = 2, SO_UNMATCHING_CONSTRAINT_ID = 3 } 
ShapeOp Success and Error type. This list might be extended. To simply test for errors, use =! SO_SUCCESS. More...  
Functions  
SHAPEOP_API ShapeOpSolver *  shapeop_create () 
Create the ShapeOp solver. For more details see ShapeOp::Solver.  
SHAPEOP_API void  shapeop_delete (ShapeOpSolver *op) 
Delete the ShapeOp solver. For more details see ShapeOp::Solver.  
SHAPEOP_API int  shapeop_init (ShapeOpSolver *op) 
Initialize the ShapeOp solver for static geometry processing. For more details see ShapeOp::Solver. More...  
SHAPEOP_API int  shapeop_initDynamic (ShapeOpSolver *op, ShapeOpScalar masses, ShapeOpScalar damping, ShapeOpScalar timestep) 
Initialize the ShapeOp solver for dynamic geometry processing. For more details see ShapeOp::Solver. More...  
SHAPEOP_API int  shapeop_solve (ShapeOpSolver *op, unsigned int iteration) 
Run the optimization. For more details see ShapeOp::Solver. More...  
SHAPEOP_API void  shapeop_setPoints (ShapeOpSolver *op, ShapeOpScalar *points, int nb_points) 
Set the vertices to the ShapeOp solver. For more details see ShapeOp::Solver.  
SHAPEOP_API void  shapeop_getPoints (ShapeOpSolver *op, ShapeOpScalar *points, int nb_points) 
Get the vertices back from the ShapeOp solver. For more details see ShapeOp::Solver.  
SHAPEOP_API void  shapeop_setTimeStep (ShapeOpSolver *op, ShapeOpScalar timestep) 
Set the timestep of the ShapeOp solver. For more details see ShapeOp::Solver.  
SHAPEOP_API void  shapeop_setDamping (ShapeOpSolver *op, ShapeOpScalar damping) 
Set the damping of the ShapeOp solver. For more details see ShapeOp::Solver.  
SHAPEOP_API int  shapeop_addConstraint (ShapeOpSolver *op, const char *constraintType, int *ids, int nb_ids, ShapeOpScalar weight) 
Add a constraint to the ShapeOp solver. More...  
SHAPEOP_API shapeop_err  shapeop_editConstraint (ShapeOpSolver *op, const char *constraintType, int constraint_id, const ShapeOpScalar *scalars, int nb_scl) 
Add a constraint to the ShapeOp solver. More...  
SHAPEOP_API int  shapeop_addGravityForce (ShapeOpSolver *op, ShapeOpScalar *force) 
Add a gravity force to the ShapeOp solver. For more details see ShapeOp::GravityForce. More...  
SHAPEOP_API int  shapeop_addVertexForce (ShapeOpSolver *op, ShapeOpScalar *force, int id) 
Add a vertex force to the ShapeOp solver. For more details see ShapeOp::VertexForce.  
SHAPEOP_API void  shapeop_editVertexForce (ShapeOpSolver *op, int force_id, ShapeOpScalar *force, int id) 
Edit a vertex force previously added to the ShapeOp solver. For more details see ShapeOp::VertexForce.  
This file implements a C API for the ShapeOp C++ library.
To use the library you need to:
1) Create the solver with shapeop_create
2) Set the vertices with shapeop_setPoints
3) Setup the constraints and forces with shapeop_addConstraint and shapeop_editConstraint
4) Initalize the solver with shapeop_init or shapeop_initDynamic
5) Optimize with shapeop_solve
6) Get back the vertices with shapeop_getPoints
7) Delete the solver with shapeop_delete
enum shapeop_err 
ShapeOp Success and Error type. This list might be extended. To simply test for errors, use =! SO_SUCCESS.
Enumerator  

SO_INVALID_CONSTRAINT_TYPE 
ShapeOp Success type indicating that no error happened. 
SO_INVALID_ARGUMENT_LENGTH 
ShapeOp Error type indicating an invalid constraint type provided. 
SO_UNMATCHING_CONSTRAINT_ID 
ShapeOp Error type indicating an invalid length of an array argument. 
SHAPEOP_API int shapeop_addConstraint  (  ShapeOpSolver *  op, 
const char *  constraintType,  
int *  ids,  
int  nb_ids,  
ShapeOpScalar  weight  
) 
Add a constraint to the ShapeOp solver.
op  The ShapeOp Solver object 
constraintType  A cstyle string containing one of the following constraint types listed in the documentation of ShapeOp::Constraint::shapeConstraintFactory:

ids  The array of indices of the points subject to the constraint. See documentation of the corresponding constraint in Constraint.h 
nb_ids  The length or number of indices in ids. 
weight  The weight of the constraint to be added relative to the other constraints in the ShapeOpSolver. 
SHAPEOP_API int shapeop_addGravityForce  (  ShapeOpSolver *  op, 
ShapeOpScalar *  force  
) 
Add a gravity force to the ShapeOp solver. For more details see ShapeOp::GravityForce.
op  The ShapeOp Solver object 
force  A cstyle array of 3 ShapeOpScalar's specifying the force vector in each dimension 
SHAPEOP_API shapeop_err shapeop_editConstraint  (  ShapeOpSolver *  op, 
const char *  constraintType,  
int  constraint_id,  
const ShapeOpScalar *  scalars,  
int  nb_scl  
) 
Add a constraint to the ShapeOp solver.
op  The ShapeOp Solver object 
constraintType  A cstyle string containing one of the following constraint types

constraint_id  The id of the constraint, which is returned in shapeop_addConstraint. 
scalars  A cstyle array of ShapeOpScalar's. See documentation of the corresponding constraint in Constraint.h 
nb_scl  The length of the array scalars. 
SHAPEOP_API int shapeop_init  (  ShapeOpSolver *  op  ) 
Initialize the ShapeOp solver for static geometry processing. For more details see ShapeOp::Solver.
SHAPEOP_API int shapeop_initDynamic  (  ShapeOpSolver *  op, 
ShapeOpScalar  masses,  
ShapeOpScalar  damping,  
ShapeOpScalar  timestep  
) 
Initialize the ShapeOp solver for dynamic geometry processing. For more details see ShapeOp::Solver.
SHAPEOP_API int shapeop_solve  (  ShapeOpSolver *  op, 
unsigned int  iteration  
) 
Run the optimization. For more details see ShapeOp::Solver.