Skip to content

Commit 5bd105b

Browse files
Homer Reidstevengj
authored andcommitted
Refactor prisms for scheme (#35)
* implement geom_fix_object for prisms (recompute centroid of polygon floor from center of geometric object); update test-prism to displace objects through random 3D vector * updates * refactor make_prism() to facilitate handling of prisms in scheme * refactor prism implementation for compatibility with legacy scheme interface * updates * updates * fix commented-out code * use random sentinel for no-val * use same NO_VAL as in scm * use nan instead of no-val * use nan for auto-center
1 parent 8474864 commit 5bd105b

5 files changed

Lines changed: 401 additions & 291 deletions

File tree

utils/ctlgeom.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ extern void display_geometric_object_info(int indentby, geometric_object o);
5151
#endif
5252

5353
extern void geom_initialize(void);
54-
extern void geom_fix_object(GEOMETRIC_OBJECT o);
54+
extern void geom_fix_object(GEOMETRIC_OBJECT *o);
5555
extern void geom_fix_objects(void);
5656
extern void geom_fix_objects0(GEOMETRIC_OBJECT_LIST geometry);
5757
extern void geom_fix_lattice(void);
@@ -147,10 +147,18 @@ GEOMETRIC_OBJECT make_block(MATERIAL_TYPE material, vector3 center,
147147
GEOMETRIC_OBJECT make_ellipsoid(MATERIAL_TYPE material, vector3 center,
148148
vector3 e1, vector3 e2, vector3 e3,
149149
vector3 size);
150+
151+
// prism with `center` field computed automatically from vertices, height, axis
150152
GEOMETRIC_OBJECT make_prism(MATERIAL_TYPE material,
151153
const vector3 *vertices, int num_vertices,
152154
double height, vector3 axis);
153155

156+
// as make_prism, but with a rigid translation so that the prism is centered at center
157+
GEOMETRIC_OBJECT make_prism_with_center(MATERIAL_TYPE material, vector3 center,
158+
const vector3 *vertices, int num_vertices,
159+
double height, vector3 axis);
160+
161+
154162
int vector3_nearly_equal(vector3 v1, vector3 v2, double tolerance);
155163

156164
/**************************************************************************/

0 commit comments

Comments
 (0)