-
Notifications
You must be signed in to change notification settings - Fork 29
Mesh geometry import #74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Luochenghuang
wants to merge
11
commits into
NanoComp:master
Choose a base branch
from
Luochenghuang:mesh-geometry-import
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
901fbbf
Add MESH geometric object type for arbitrary triangulated 3D surfaces
Luochenghuang 8e485b3
Fix point_in_mesh robustness and reinit_mesh performance
Luochenghuang bf127c3
Lazy majority vote and mesh closure validation
Luochenghuang 4172d4d
Add closure validation edge case tests
Luochenghuang f9e8d30
Eliminate redundant BVH build and point_in_mesh fallback
Luochenghuang ca738ad
Minor cleanups: remove dead code, optimize BVH queries
Luochenghuang 6b3b589
Add mesh API documentation to ctlgeom.h
Luochenghuang 643acf1
Include generated ctlgeom-types.h and geom-ctl-io.c
Luochenghuang a1001d3
Address PR feedback: relative lengthscale tolerances and mesh input d…
Luochenghuang ad9e00d
Fix 3 bugs found in code review: per-component winding, dynamic ray-h…
Luochenghuang 4e795b4
Drop vertex_hash mutation detection in reinit_mesh
Luochenghuang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,210 @@ | ||
| /* THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT MODIFY! */ | ||
| /* generated from the file: ./geom.scm */ | ||
|
|
||
| #ifndef CTL_IO_H | ||
| #define CTL_IO_H | ||
|
|
||
| #include <ctl-math.h> | ||
|
|
||
| #ifdef __cplusplus | ||
| extern "C" { | ||
| #endif /* __cplusplus */ | ||
|
|
||
| /******* Type declarations *******/ | ||
|
|
||
| typedef struct geometric_object_struct { | ||
| void* material; | ||
| vector3 center; | ||
| enum { | ||
| GEOMETRIC_OBJECT_SELF, PRISM, BLOCK, SPHERE, CYLINDER, COMPOUND_GEOMETRIC_OBJECT, MESH | ||
| } which_subclass; | ||
| union { | ||
| struct prism_struct *prism_data; | ||
| struct block_struct *block_data; | ||
| struct sphere_struct *sphere_data; | ||
| struct cylinder_struct *cylinder_data; | ||
| struct compound_geometric_object_struct *compound_geometric_object_data; | ||
| struct mesh_struct *mesh_data; | ||
| } subclass; | ||
| } geometric_object; | ||
|
|
||
| typedef struct { | ||
| int num_items; | ||
| geometric_object *items; | ||
| } geometric_object_list; | ||
|
|
||
| typedef struct compound_geometric_object_struct { | ||
| geometric_object_list component_objects; | ||
| } compound_geometric_object; | ||
|
|
||
| typedef struct cylinder_struct { | ||
| vector3 axis; | ||
| number radius; | ||
| number height; | ||
| enum { | ||
| CYLINDER_SELF, WEDGE, CONE | ||
| } which_subclass; | ||
| union { | ||
| struct wedge_struct *wedge_data; | ||
| struct cone_struct *cone_data; | ||
| } subclass; | ||
| } cylinder; | ||
|
|
||
| typedef struct cone_struct { | ||
| number radius2; | ||
| } cone; | ||
|
|
||
| typedef struct wedge_struct { | ||
| number wedge_angle; | ||
| vector3 wedge_start; | ||
| vector3 e1; | ||
| vector3 e2; | ||
| } wedge; | ||
|
|
||
| typedef struct sphere_struct { | ||
| number radius; | ||
| } sphere; | ||
|
|
||
| typedef struct block_struct { | ||
| vector3 e1; | ||
| vector3 e2; | ||
| vector3 e3; | ||
| vector3 size; | ||
| matrix3x3 projection_matrix; | ||
| enum { | ||
| BLOCK_SELF, ELLIPSOID | ||
| } which_subclass; | ||
| union { | ||
| struct ellipsoid_struct *ellipsoid_data; | ||
| } subclass; | ||
| } block; | ||
|
|
||
| typedef struct { | ||
| int num_items; | ||
| vector3 *items; | ||
| } vector3_list; | ||
|
|
||
| typedef struct { | ||
| int num_items; | ||
| number *items; | ||
| } number_list; | ||
|
|
||
| typedef struct prism_struct { | ||
| vector3_list vertices; | ||
| number height; | ||
| vector3 axis; | ||
| number sidewall_angle; | ||
| vector3_list vertices_p; | ||
| vector3_list top_polygon_diff_vectors_p; | ||
| vector3_list top_polygon_diff_vectors_scaled_p; | ||
| vector3_list vertices_top_p; | ||
| vector3_list vertices_top; | ||
| vector3 centroid; | ||
| number_list workspace; | ||
| matrix3x3 m_c2p; | ||
| matrix3x3 m_p2c; | ||
| } prism; | ||
|
|
||
| typedef struct mesh_bvh_node { | ||
| vector3 bbox_low; | ||
| vector3 bbox_high; | ||
| int left_child; | ||
| int right_child; | ||
| int face_start; | ||
| int face_count; | ||
| } mesh_bvh_node; | ||
|
|
||
| typedef struct mesh_struct { | ||
| vector3_list vertices; | ||
| int num_faces; | ||
| int *face_indices; | ||
| vector3 *face_normals; | ||
| number *face_areas; | ||
| int num_bvh_nodes; | ||
| mesh_bvh_node *bvh; | ||
| int *bvh_face_ids; | ||
| boolean is_closed; | ||
| vector3 centroid; | ||
| number lengthscale; | ||
| } mesh; | ||
|
|
||
| typedef struct ellipsoid_struct { | ||
| vector3 inverse_semi_axes; | ||
| } ellipsoid; | ||
|
|
||
| typedef struct lattice_struct { | ||
| vector3 basis1; | ||
| vector3 basis2; | ||
| vector3 basis3; | ||
| vector3 size; | ||
| vector3 basis_size; | ||
| vector3 b1; | ||
| vector3 b2; | ||
| vector3 b3; | ||
| matrix3x3 basis; | ||
| matrix3x3 metric; | ||
| } lattice; | ||
|
|
||
| /******* Input variables *******/ | ||
| extern integer dimensions; | ||
| extern void* default_material; | ||
| extern vector3 geometry_center; | ||
| extern lattice geometry_lattice; | ||
| extern geometric_object_list geometry; | ||
| extern boolean ensure_periodicity; | ||
|
|
||
| /******* Output variables *******/ | ||
|
|
||
| /******* class copy function prototypes *******/ | ||
|
|
||
| extern void lattice_copy(const lattice * o0, lattice * o); | ||
| extern void ellipsoid_copy(const ellipsoid * o0, ellipsoid * o); | ||
| extern void mesh_copy(const mesh * o0, mesh * o); | ||
| extern void prism_copy(const prism * o0, prism * o); | ||
| extern void block_copy(const block * o0, block * o); | ||
| extern void sphere_copy(const sphere * o0, sphere * o); | ||
| extern void wedge_copy(const wedge * o0, wedge * o); | ||
| extern void cone_copy(const cone * o0, cone * o); | ||
| extern void cylinder_copy(const cylinder * o0, cylinder * o); | ||
| extern void compound_geometric_object_copy(const compound_geometric_object * o0, compound_geometric_object * o); | ||
| extern void geometric_object_copy(const geometric_object * o0, geometric_object * o); | ||
|
|
||
| /******* class equal function prototypes *******/ | ||
|
|
||
| extern boolean lattice_equal(const lattice * o0, const lattice * o); | ||
| extern boolean ellipsoid_equal(const ellipsoid * o0, const ellipsoid * o); | ||
| extern boolean mesh_equal(const mesh * o0, const mesh * o); | ||
| extern boolean prism_equal(const prism * o0, const prism * o); | ||
| extern boolean block_equal(const block * o0, const block * o); | ||
| extern boolean sphere_equal(const sphere * o0, const sphere * o); | ||
| extern boolean wedge_equal(const wedge * o0, const wedge * o); | ||
| extern boolean cone_equal(const cone * o0, const cone * o); | ||
| extern boolean cylinder_equal(const cylinder * o0, const cylinder * o); | ||
| extern boolean compound_geometric_object_equal(const compound_geometric_object * o0, const compound_geometric_object * o); | ||
| extern boolean geometric_object_equal(const geometric_object * o0, const geometric_object * o); | ||
|
|
||
| /******* class destruction function prototypes *******/ | ||
|
|
||
| extern void lattice_destroy(lattice o); | ||
| extern void ellipsoid_destroy(ellipsoid o); | ||
| extern void mesh_destroy(mesh o); | ||
| extern void prism_destroy(prism o); | ||
| extern void block_destroy(block o); | ||
| extern void sphere_destroy(sphere o); | ||
| extern void wedge_destroy(wedge o); | ||
| extern void cone_destroy(cone o); | ||
| extern void cylinder_destroy(cylinder o); | ||
| extern void compound_geometric_object_destroy(compound_geometric_object o); | ||
| extern void geometric_object_destroy(geometric_object o); | ||
|
|
||
|
|
||
| #ifdef __cplusplus | ||
| } /* extern "C" */ | ||
| #endif /* __cplusplus */ | ||
|
|
||
| #endif /* CTL_IO_H */ | ||
| #ifndef LIBCTL_MAJOR_VERSION | ||
| # define LIBCTL_MAJOR_VERSION 4 | ||
| # define LIBCTL_MINOR_VERSION 5 | ||
| # define LIBCTL_BUGFIX_VERSION 1 | ||
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.