ShapeOp
 All Classes Files Functions Variables Typedefs Macros Pages
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 #ifdef __cplusplus
41 extern "C" {
42 #endif
43 // Solver
46 SHAPEOP_API ShapeOpSolver *shapeop_create();
48 SHAPEOP_API void shapeop_delete(ShapeOpSolver *op);
50 SHAPEOP_API int shapeop_init(ShapeOpSolver *op);
52 SHAPEOP_API int shapeop_initDynamic(ShapeOpSolver *op, ShapeOpScalar masses, ShapeOpScalar damping, ShapeOpScalar timestep);
54 SHAPEOP_API int shapeop_solve(ShapeOpSolver *op, unsigned int iteration);
55 
57 SHAPEOP_API void shapeop_setPoints(ShapeOpSolver *op, ShapeOpScalar *points, int nb_points);
59 SHAPEOP_API void shapeop_getPoints(ShapeOpSolver *op, ShapeOpScalar *points, int nb_points);
60 
62 SHAPEOP_API void shapeop_setTimeStep(ShapeOpSolver *op, ShapeOpScalar timestep);
64 SHAPEOP_API void shapeop_setDamping(ShapeOpSolver *op, ShapeOpScalar damping);
65 
67 SHAPEOP_API ShapeOpScalar shapeop_getConstraintError(ShapeOpSolver *op, int constraint_id);
69 // Constraints
71 SHAPEOP_API int shapeop_addEdgeStrainConstraint(ShapeOpSolver *op, int id1, int id2, ShapeOpScalar weight);
73 SHAPEOP_API void shapeop_editEdgeStrainConstraint(ShapeOpSolver *op, int constraint_id, ShapeOpScalar length);
74 
76 SHAPEOP_API int shapeop_addTriangleStrainConstraint(ShapeOpSolver *op, int id1, int id2, int id3, ShapeOpScalar weight);
77 
79 SHAPEOP_API int shapeop_addTetrahedronStrainConstraint(ShapeOpSolver *op, int id1, int id2, int id3, int id4, ShapeOpScalar weight);
80 
82 SHAPEOP_API int shapeop_addAreaConstraint(ShapeOpSolver *op, int id1, int id2, int id3, ShapeOpScalar weight);
83 
85 SHAPEOP_API int shapeop_addVolumeConstraint(ShapeOpSolver *op, int id1, int id2, int id3, int id4, ShapeOpScalar weight);
86 
88 SHAPEOP_API int shapeop_addBendingConstraint(ShapeOpSolver *op, int *ids, int nb_ids, ShapeOpScalar weight);
89 
91 SHAPEOP_API int shapeop_addClosenessConstraint(ShapeOpSolver *op, int id, ShapeOpScalar weight);
93 SHAPEOP_API void shapeop_editClosenessConstraint(ShapeOpSolver *op, int constraint_id, ShapeOpScalar *point);
94 
96 SHAPEOP_API int shapeop_addLineConstraint(ShapeOpSolver *op, int *ids, int nb_ids, ShapeOpScalar weight);
97 
99 SHAPEOP_API int shapeop_addPlaneConstraint(ShapeOpSolver *op, int *ids, int nb_ids, ShapeOpScalar weight);
100 
102 SHAPEOP_API int shapeop_addCircleConstraint(ShapeOpSolver *op, int *ids, int nb_ids, ShapeOpScalar weight);
103 
105 SHAPEOP_API int shapeop_addSphereConstraint(ShapeOpSolver *op, int *ids, int nb_ids, ShapeOpScalar weight);
106 
108 SHAPEOP_API int shapeop_addUniformLaplacianConstraint(ShapeOpSolver *op, int *ids, int nb_ids, int displacement_lap, ShapeOpScalar weight);
110 // Forces
112 SHAPEOP_API int shapeop_addGravityForce(ShapeOpSolver *op, ShapeOpScalar *force);
113 
115 SHAPEOP_API int shapeop_addVertexForce(ShapeOpSolver *op, ShapeOpScalar *force, int id);
117 SHAPEOP_API void shapeop_editVertexForce(ShapeOpSolver *op, int force_id, ShapeOpScalar *force, int id);
119 #ifdef __cplusplus
120 }
121 #endif
122 #endif // API_H
124 
SHAPEOP_API int shapeop_addPlaneConstraint(ShapeOpSolver *op, int *ids, int nb_ids, ShapeOpScalar weight)
Add a plane constraint to the ShapeOp solver. For more details see ShapeOp::PlaneConstraint.
Definition: API.cpp:102
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:32
SHAPEOP_API ShapeOpScalar shapeop_getConstraintError(ShapeOpSolver *op, int constraint_id)
Run the optimization. For more details see ShapeOp::Solver.
Definition: API.cpp:123
SHAPEOP_API int shapeop_addLineConstraint(ShapeOpSolver *op, int *ids, int nb_ids, ShapeOpScalar weight)
Add a line constraint to the ShapeOp solver. For more details see ShapeOp::LineConstraint.
Definition: API.cpp:97
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:132
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:38
SHAPEOP_API void shapeop_editClosenessConstraint(ShapeOpSolver *op, int constraint_id, ShapeOpScalar *point)
Edit a closeness constraint previously added to the ShapeOp solver. For more details see ShapeOp::Clo...
Definition: API.cpp:92
SHAPEOP_API int shapeop_addCircleConstraint(ShapeOpSolver *op, int *ids, int nb_ids, ShapeOpScalar weight)
Add a circle constraint to the ShapeOp solver. For more details see ShapeOp::CircleConstraint.
Definition: API.cpp:107
SHAPEOP_API int shapeop_addClosenessConstraint(ShapeOpSolver *op, int id, ShapeOpScalar weight)
Add a closeness constraint to the ShapeOp solver. For more details see ShapeOp::ClosenessConstraint.
Definition: API.cpp:87
SHAPEOP_API void shapeop_delete(ShapeOpSolver *op)
Delete the ShapeOp solver. For more details see ShapeOp::Solver.
Definition: API.cpp:26
SHAPEOP_API int shapeop_addUniformLaplacianConstraint(ShapeOpSolver *op, int *ids, int nb_ids, int displacement_lap, ShapeOpScalar weight)
Add a uniform laplacian constraint to the ShapeOp solver. For more details see ShapeOp::UniformLaplac...
Definition: API.cpp:117
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:49
SHAPEOP_API int shapeop_addEdgeStrainConstraint(ShapeOpSolver *op, int id1, int id2, ShapeOpScalar weight)
Add an edge strain constraint to the ShapeOp solver. For more details see ShapeOp::EdgeStrainConstrai...
Definition: API.cpp:53
SHAPEOP_API int shapeop_addBendingConstraint(ShapeOpSolver *op, int *ids, int nb_ids, ShapeOpScalar weight)
Add a bending constraint to the ShapeOp solver. For more details see ShapeOp::BendingConstraint.
Definition: API.cpp:82
SHAPEOP_API int shapeop_addAreaConstraint(ShapeOpSolver *op, int id1, int id2, int id3, ShapeOpScalar weight)
Add an area constraint to the ShapeOp solver. For more details see ShapeOp::AreaConstraint.
Definition: API.cpp:72
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:42
SHAPEOP_API void shapeop_editEdgeStrainConstraint(ShapeOpSolver *op, int constraint_id, ShapeOpScalar length)
Edit an edge strain constraint previously added to the ShapeOp solver. For more details see ShapeOp::...
Definition: API.cpp:58
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:46
SHAPEOP_API int shapeop_addTetrahedronStrainConstraint(ShapeOpSolver *op, int id1, int id2, int id3, int id4, ShapeOpScalar weight)
Add a tetrahedron strain constraint to the ShapeOp solver. For more details see ShapeOp::TetrahedronS...
Definition: API.cpp:67
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:137
Definition: API.cpp:17
SHAPEOP_API int shapeop_init(ShapeOpSolver *op)
Initialize the ShapeOp solver for static geometry processing. For more details see ShapeOp::Solver...
Definition: API.cpp:29
SHAPEOP_API int shapeop_addTriangleStrainConstraint(ShapeOpSolver *op, int id1, int id2, int id3, ShapeOpScalar weight)
Add a triangle strain constraint to the ShapeOp solver. For more details see ShapeOp::TriangleStrainC...
Definition: API.cpp:62
SHAPEOP_API int shapeop_addVolumeConstraint(ShapeOpSolver *op, int id1, int id2, int id3, int id4, ShapeOpScalar weight)
Add a volume constraint to the ShapeOp solver. For more details see ShapeOp::VolumeConstraint.
Definition: API.cpp:77
SHAPEOP_API ShapeOpSolver * shapeop_create()
Create the ShapeOp solver. For more details see ShapeOp::Solver.
Definition: API.cpp:21
SHAPEOP_API int shapeop_addSphereConstraint(ShapeOpSolver *op, int *ids, int nb_ids, ShapeOpScalar weight)
Add a sphere constraint to the ShapeOp solver. For more details see ShapeOp::SphereConstraint.
Definition: API.cpp:112
SHAPEOP_API int shapeop_solve(ShapeOpSolver *op, unsigned int iteration)
Run the optimization. For more details see ShapeOp::Solver.
Definition: API.cpp:35
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:127