commit 19c0d487c13b6bc3e504d0fed5776e30aee82d79
parent 32067cb4e179d012983e6d0db49b81a44dfa43c7
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Wed, 4 Nov 2015 18:29:45 +0100
Prepare the addition of the supershape distribution
Add the supershape <geometry|distribution> context data structure.
Diffstat:
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/src/schiff_geometry.c b/src/schiff_geometry.c
@@ -45,6 +45,12 @@ struct cylinder_context {
float height;
};
+/* 3D Context of the super shape geometry */
+enum { A, B, M, N0, N1, N2 };
+struct supershape_context {
+ double super_formulas[2][6];
+};
+
/* Distribution context of a sphere geometry */
struct sphere_distribution_context {
double log_mean_radius; /* Log of the mean radius */
@@ -58,6 +64,12 @@ struct cylinder_distribution_context {
double aspect_ratio; /* aspect ratio of the cylinder distribution */
};
+/* Distribtion context of a super shape geometry */
+struct supershape_distribution_context {
+ double lower[2][6]; /* Lower bound of the super formula parameters */
+ double upper[2][6]; /* Upper bound of the super formula parameters */
+};
+
/* 3D context of a generic geometry */
struct geometry_context {
struct schiff_mesh* mesh; /* Triangular mesh of the geometry */
@@ -65,6 +77,7 @@ struct geometry_context {
union {
struct cylinder_context cylinder;
struct sphere_context sphere;
+ struct supershape_context supershape;
} data;
};
@@ -76,6 +89,7 @@ struct geometry_distribution_context {
union {
struct cylinder_distribution_context cylinder;
struct sphere_distribution_context sphere;
+ struct supershape_distribution_context supershape;
} data;
};
@@ -105,7 +119,7 @@ cylinder_get_position(const unsigned ivert, float vertex[3], void* ctx)
{
struct geometry_context* geom = ctx;
ASSERT(geom && geom->type == SCHIFF_CYLINDER);
- schiff_mesh_get_position(geom->mesh, ivert, vertex);
+ schiff_mesh_get_cartesian_position(geom->mesh, ivert, vertex);
vertex[0] *= geom->data.cylinder.radius;
vertex[1] *= geom->data.cylinder.radius;
vertex[2] *= geom->data.cylinder.height;
@@ -116,7 +130,7 @@ sphere_get_position(const unsigned ivert, float vertex[3], void* ctx)
{
struct geometry_context* geom = ctx;
ASSERT(geom && geom->type == SCHIFF_SPHERE);
- schiff_mesh_get_position(geom->mesh, ivert, vertex);
+ schiff_mesh_get_cartesian_position(geom->mesh, ivert, vertex);
vertex[0] *= geom->data.sphere.radius;
vertex[1] *= geom->data.sphere.radius;
vertex[2] *= geom->data.sphere.radius;