#pragma once #include #include typedef enum { // PRIMITIVE_TYPE_CONSTANT, // PRIMITIVE_TYPE_PLANE, PRIMITIVE_TYPE_SPHERE, PRIMITIVE_TYPE_CYLINDER, PRIMITIVE_TYPE_CONE, PRIMITIVE_TYPE_BOX, // PRIMITIVE_TYPE_MESH, PRIMITIVE_TYPE_EXTRUDE_POLYLINE, PRIMITIVE_TYPE_EXTRUDE_HELIXLINE } primitive_type; // // Placeholder, currently used to represent empty body // typedef struct { // double value; // Use 0 to represent an empty body // } constant_descriptor_t; // // Plane descriptor // typedef struct { // vector3d point; // The base point of the plane // vector3d normal; // The normal of the plane // } plane_descriptor_t; // Sphere descriptor typedef struct { vector3d center; // The ceter of the sphere double radius; // The radius of the sphere } sphere_descriptor_t; // Cylinder descriptor typedef struct { vector3d bottom_origion; // The origion of bottom face of the cylinder double radius; // The radius of the cylinder vector3d offset; // The vector from the origion of bottom face to the origion of the top face } cylinder_descriptor_t; typedef struct { vector3d top_point; // The origion of top face of the cone vector3d bottom_point; // The origion of bottom face of the cone double radius1; // The radius of the top face double radius2; // The radius of the bottom face } cone_descriptor_t; typedef struct { vector3d center; // The center of the box vector3d half_size; // The { half_length, half_width, half_height} of the box } box_descriptor_t; // // Mesh descriptor // typedef struct { // uint32_t begin_index; // uint32_t vertex_count; // } polygon_face_descriptor_t; // typedef struct { // uint32_t point_number; // The point number of the mesh // uint32_t face_number; // The face number of the mesh // vector3d* points; // The points of the mesh // uint32_t* indices; // The indices from face to point // polygon_face_descriptor_t* faces; // Two-dimensional array, Use [begin index, length] to represent a face // } mesh_descriptor_t; // Extrude descriptor // CAUTION: when looking into the polyline from -{reference_normal} direction, all points should be arranged in counter // clockwise order // CAUTION: iff {is_closed} is true, then {point_number} == {bulge_number} should be agreed; iff {is_closed} is false, // then {point_number} == {bulge_number} + 1 should be agreed. typedef struct { uint32_t point_number; // The point number of the polyline vector3d* points; // The points of the polyline uint32_t bulge_number; // The bulge number of the polyline double* bulges; // The bulge of each edge vector3d reference_normal; // The reference normal of the polyline bool is_close; // Whether the polyline is close } polyline_descriptor_t; typedef struct { vector3d axis_start; // The start point of the helix line vector3d axis_end; // The end point of the helix line double radius; // The radius of the helix line double advance_per_round; // he advance per round of the helix line vector3d start_direction; // The direction from axisStart to start of the helix line bool is_righthanded; // {axis_start -> axis_end} as upward direction } helixline_descriptor_t; // Note : In profiles, The first polyline is outer boundary, and the ohters is internal holes typedef struct { uint32_t profile_number; // The profiles number of the extruded solid polyline_descriptor_t* profiles; // The profiles of the extruded solid polyline_descriptor_t axis; // The axis of the extruded solid } extrude_polyline_descriptor_t; typedef struct { uint32_t profile_number; // The profiles number of the extruded solid polyline_descriptor_t* profiles; // The profiles of the extruded solid helixline_descriptor_t axis; // The axis of the extruded solid } extrude_helixline_descriptor_t;