ShapeOp  0.1.0
API.h
Go to the documentation of this file.
1 // This file is part of ShapeOp, a lightweight C++ library
3 // for static and dynamic geometry processing.
4 //
5 // Copyright (C) 2014 Sofien Bouaziz <sofien.bouaziz@gmail.com>
6 // Copyright (C) 2014 LGG EPFL
7 //
8 // This Source Code Form is subject to the terms of the Mozilla
9 // Public License v. 2.0. If a copy of the MPL was not distributed
10 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
12 #ifndef API_H
13 #define API_H
14 #include "Common.h"
17 
36 
40 
41 typedef enum shapeop_err {
42  SO_SUCCESS = 0,
46 } shapeop_err;
48 #ifdef __cplusplus
49 extern "C" {
50 #endif
51 // Solver
65 SHAPEOP_API int shapeop_solve(ShapeOpSolver *op, unsigned int iteration);
66 
68 SHAPEOP_API void shapeop_setPoints(ShapeOpSolver *op, ShapeOpScalar *points, int nb_points);
70 SHAPEOP_API void shapeop_getPoints(ShapeOpSolver *op, ShapeOpScalar *points, int nb_points);
71 
76 
78 // Constraints
79 
106 SHAPEOP_API int shapeop_addConstraint(ShapeOpSolver *op, const char *constraintType, int *ids, int nb_ids, ShapeOpScalar weight);
107 
128  const char *constraintType,
129  int constraint_id,
130  const ShapeOpScalar *scalars,
131  int nb_scl);
133 // Forces
139 
143 SHAPEOP_API void shapeop_editVertexForce(ShapeOpSolver *op, int force_id, ShapeOpScalar *force, int id);
145 #ifdef __cplusplus
146 }
147 #endif
148 #endif // API_H
150 
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...
Definition: API.cpp:34
SHAPEOP_SCALAR ShapeOpScalar
Defines the scalar type used by the ShapeOp solver (float or double).
Definition: Common.h:23
shapeop_err
ShapeOp Success and Error type. This list might be extended. To simply test for errors, use =! SO_SUCCESS.
Definition: API.h:41
ShapeOp Error type indicating an invalid constraint type provided.
Definition: API.h:44
ShapeOp Success type indicating that no error happened.
Definition: API.h:43
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.
Definition: API.cpp:162
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.
Definition: API.cpp:40
SHAPEOP_API void shapeop_delete(ShapeOpSolver *op)
Delete the ShapeOp solver. For more details see ShapeOp::Solver.
Definition: API.cpp:28
SHAPEOP_API void shapeop_setDamping(ShapeOpSolver *op, ShapeOpScalar damping)
Set the damping of the ShapeOp solver. For more details see ShapeOp::Solver.
Definition: API.cpp:51
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.
Definition: API.cpp:44
SHAPEOP_API void shapeop_setTimeStep(ShapeOpSolver *op, ShapeOpScalar timestep)
Set the timestep of the ShapeOp solver. For more details see ShapeOp::Solver.
Definition: API.cpp:48
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...
Definition: API.cpp:167
#define SHAPEOP_API
Defines the API prefix for the current platform.
Definition: Common.h:34
C structure that containts the C++ ShapeOp solver.
Definition: API.cpp:18
SHAPEOP_API int shapeop_init(ShapeOpSolver *op)
Initialize the ShapeOp solver for static geometry processing. For more details see ShapeOp::Solver...
Definition: API.cpp:31
SHAPEOP_API ShapeOpSolver * shapeop_create()
Create the ShapeOp solver. For more details see ShapeOp::Solver.
Definition: API.cpp:23
ShapeOp Error type indicating an invalid length of an array argument.
Definition: API.h:45
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.
Definition: API.cpp:63
SHAPEOP_API int shapeop_solve(ShapeOpSolver *op, unsigned int iteration)
Run the optimization. For more details see ShapeOp::Solver.
Definition: API.cpp:37
SHAPEOP_API int shapeop_addConstraint(ShapeOpSolver *op, const char *constraintType, int *ids, int nb_ids, ShapeOpScalar weight)
Add a constraint to the ShapeOp solver.
Definition: API.cpp:55
SHAPEOP_API int shapeop_addGravityForce(ShapeOpSolver *op, ShapeOpScalar *force)
Add a gravity force to the ShapeOp solver. For more details see ShapeOp::GravityForce.
Definition: API.cpp:157