Skip to content

Commit 69209a4

Browse files
Homer Reidstevengj
authored andcommitted
add support for prisms (new type of geometric_object) to libctlgeom (#13)
* add support for prisms (new type of geometric_object) to libctlgeom * updates * updates to point_in_prism and other functions * implemented intersect_line_with_object for prisms; added working unit test to test-prism.c * updates * new function intersect_line_segment_with_object * finished implementing all geometry primitives for prisms; added passing unit test utils/test-prism.c * finished implementing all geometry primitives for prisms; added passing unit test utils/test-prism.c * inserted content of prism.c into geom.c, made updates to enable mpb and meep builds * fixed compilation issues for test-prism
1 parent 409cd32 commit 69209a4

5 files changed

Lines changed: 957 additions & 16 deletions

File tree

utils/Makefile.am

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@ geomtst_SOURCES = geomtst.c
1414
geomtst_LDADD = libctlgeom.la
1515
geomtst_CPPFLAGS = -I$(top_srcdir)/src
1616

17+
check_PROGRAMS = test-prism
18+
19+
test_prism_SOURCES = test-prism.c
20+
test_prism_LDADD = libctlgeom.la
21+
22+
TESTS = test-prism
23+
1724
dist_man_MANS = gen-ctl-io.1
1825

1926
BUILT_SOURCES = gen-ctl-io geom-ctl-io.c ctlgeom-types.h nlopt-constants.scm

utils/ctlgeom.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ extern vector3 normal_to_object(vector3 p, GEOMETRIC_OBJECT o);
6969
extern vector3 normal_to_fixed_object(vector3 p, GEOMETRIC_OBJECT o);
7070
extern int intersect_line_with_object(vector3 p, vector3 d, GEOMETRIC_OBJECT o,
7171
double s[2]);
72+
extern double intersect_line_segment_with_object(vector3 p, vector3 d,
73+
GEOMETRIC_OBJECT o,
74+
double a, double b);
7275
extern MATERIAL_TYPE material_of_point_inobject(vector3 p, boolean *inobject);
7376
extern MATERIAL_TYPE material_of_point_inobject0(
7477
GEOMETRIC_OBJECT_LIST geometry, vector3 p, boolean *inobject);
@@ -144,7 +147,11 @@ GEOMETRIC_OBJECT make_block(MATERIAL_TYPE material, vector3 center,
144147
GEOMETRIC_OBJECT make_ellipsoid(MATERIAL_TYPE material, vector3 center,
145148
vector3 e1, vector3 e2, vector3 e3,
146149
vector3 size);
150+
GEOMETRIC_OBJECT make_prism(MATERIAL_TYPE material,
151+
const vector3 *vertices, int num_vertices,
152+
double height, vector3 axis);
147153

154+
int vector3_nearly_equal(vector3 v1, vector3 v2, double tolerance);
148155

149156
/**************************************************************************/
150157

0 commit comments

Comments
 (0)