solstice-solver

Solver library of the solstice app
git clone git://git.meso-star.com/solstice-solver.git
Log | Files | Refs | README | LICENSE

commit e08fda6030de1bc1e65d0fcff3dbad679afda121
parent 3a215550d9bfc2ced499cb1d81d7d4497af9098e
Author: Christophe Coustet <christophe.coustet@meso-star.com>
Date:   Fri, 30 Sep 2016 17:12:03 +0200

First proposal for quadrics discretisation level tuning

Diffstat:
Msrc/ssol_shape.c | 26+++++++++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/src/ssol_shape.c b/src/ssol_shape.c @@ -25,6 +25,7 @@ #include <rsys/mem_allocator.h> #include <rsys/ref_count.h> #include <rsys/rsys.h> +#include <rsys/math.h> #include <star/scpr.h> @@ -852,7 +853,30 @@ ssol_punched_surface_setup } /* Define the #slices of the discretized quadric */ - nslices = psurf->quadric->type == SSOL_QUADRIC_PLANE ? 1 : 50; + switch (psurf->quadric->type) { + case SSOL_QUADRIC_PLANE: + nslices = 1; + break; + case SSOL_QUADRIC_PARABOL: { + double z[2]; + z[0] = (lower[0] * lower[0] + lower[1] * lower[1]) + / (4.0 * psurf->quadric->data.parabol.focal); + z[1] = (upper[0] * upper[0] + upper[1] * upper[1]) + / (4.0 * psurf->quadric->data.parabol.focal); + nslices = MMIN(50, (size_t)(1 + MMAX(z[0], z[1]) * 4)); + break; + } + case SSOL_QUADRIC_PARABOLIC_CYLINDER: { + double z[2]; + z[0] = (lower[1] * lower[1]) / + (4.0 * psurf->quadric->data.parabolic_cylinder.focal); + z[1] = (upper[1] * upper[1]) / + (4.0 * psurf->quadric->data.parabolic_cylinder.focal); + nslices = MMIN(50, (size_t)(1 + MMAX(z[0], z[1]) * 4)); + break; + } + default: FATAL("Unreachable code\n"); break; + } res = build_triangulated_plane(&coords, &ids, lower, upper, nslices); if(res != RES_OK) goto error;