commit 8f2977153ef3491659a97220149210438c617a41
parent 625e076e7922b7b2ccfb61be1e3353ffed157588
Author: Christophe Coustet <christophe.coustet@meso-star.com>
Date: Mon, 27 Jan 2020 18:03:32 +0100
API rename
Diffstat:
17 files changed, 455 insertions(+), 453 deletions(-)
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
@@ -150,7 +150,7 @@ if(NOT NO_TEST)
new_test(test_sg3_cube_on_cube)
new_test(test_sg3_some_enclosures test_sg3_utils2.h)
new_test(test_sg3_some_triangles test_sg3_utils2.h)
- new_test(test_sg3_undefined_properties)
+ new_test(test_sg3_unspecified_properties)
target_link_libraries(test_sg3_some_enclosures Star3DUT)
target_link_libraries(test_sg3_some_triangles Star3DUT)
@@ -160,7 +160,7 @@ if(NOT NO_TEST)
rcmake_copy_runtime_libraries(test_sg3_cube_on_cube)
rcmake_copy_runtime_libraries(test_sg3_some_enclosures)
rcmake_copy_runtime_libraries(test_sg3_some_triangles)
- rcmake_copy_runtime_libraries(test_sg3_undefined_properties)
+ rcmake_copy_runtime_libraries(test_sg3_unspecified_properties)
endif()
if(HUGE_ADDITIONAL_TESTS)
diff --git a/src/sg3.h b/src/sg3.h
@@ -67,28 +67,30 @@ enum sg3_property_type {
* A type to list the different possible partitions of triangles.
******************************************************************************/
enum sg3_dump_content {
- SG3_MERGE_CONFLICTS = BIT(0),
- SG3_PROPERTY_CONFLICTS = BIT(1),
- SG3_VALID_TRIANGLE = BIT(2),
- SG3_ALL_TRIANGLES =
- SG3_MERGE_CONFLICTS | SG3_PROPERTY_CONFLICTS | SG3_VALID_TRIANGLE
+ SG3_OBJ_DUMP_MERGE_CONFLICTS = BIT(0),
+ SG3_OBJ_DUMP_PROPERTY_CONFLICTS = BIT(1),
+ SG3_OBJ_DUMP_VALID_PRIMITIVE = BIT(2),
+ SG3_OBJ_DUMP_ALL =
+ SG3_OBJ_DUMP_MERGE_CONFLICTS
+ | SG3_OBJ_DUMP_PROPERTY_CONFLICTS
+ | SG3_OBJ_DUMP_VALID_PRIMITIVE
};
/*******************************************************************************
* A type to list the different qualifiers of C code variable output.
******************************************************************************/
enum sg3_cdump_qualifiers {
- SG3_CDUMP_CONST = BIT(0),
- SG3_CDUMP_STATIC = BIT(1)
+ SG3_C_DUMP_CONST = BIT(0),
+ SG3_C_DUMP_STATIC = BIT(1)
};
/*******************************************************************************
* The value that should be used for properties attached to triangles (i.e.
- * media or interface) when not defined.
- * SG3_UNDEFINED_PROPERTY can be used for a property that has already been
+ * media or interface) when let unspecified.
+ * SG3_UNSPECIFIED_PROPERTY can be used for a property that has already been
* defined; in this case the previous value will remain.
******************************************************************************/
-#define SG3_UNDEFINED_PROPERTY UINT_MAX
+#define SG3_UNSPECIFIED_PROPERTY UINT_MAX
/*******************************************************************************
* A type to hold callbacks for sg3_geometry_add.
@@ -98,7 +100,7 @@ struct sg3_geometry_add_callbacks {
void(*get_indices)
(const unsigned itri, unsigned ids[3], void* context);
/* User function that provides properties for added triangles */
- void(*get_properties) /* Can be NULL <=> SG3_UNDEFINED_PROPERTY used */
+ void(*get_properties) /* Can be NULL <=> SG3_UNSPECIFIED_PROPERTY used */
(const unsigned itri,
/* It is OK to have side and interface properties sharing the same IDs,
* i.e. side and interface IDs both starting from 0 */
@@ -151,7 +153,7 @@ sg3_compatible_property
(const unsigned p1,
const unsigned p2)
{
- if(p1 == SG3_UNDEFINED_PROPERTY || p2 == SG3_UNDEFINED_PROPERTY) return 1;
+ if(p1 == SG3_UNSPECIFIED_PROPERTY || p2 == SG3_UNSPECIFIED_PROPERTY) return 1;
return (p1 == p2);
}
@@ -197,7 +199,7 @@ sg3_geometry_reserve
/* Add a new set of 3D vertices and triangles to the geometry; triangles can
* be decorated with 3 properties (front and back media and interface) that can
- * be let undefined using the SG3_UNDEFINED_PROPERTY special value.
+ * be let unspecified using the SG3_UNSPECIFIED_PROPERTY special value.
* Vertices can be duplicates and are silently deduplicated, always valid.
* Triangles can be duplicates, but this can be ruled invalid due to property
* inconsistency. Triangle duplicates are silently deduplicated, even if
@@ -214,14 +216,14 @@ sg3_geometry_reserve
* merge_conflict_status int* paramater (0 for consistent; any other value
* for inconsistent, this value being recorded); regardless of
* merge_conflict_status, the callback can change the properties of the
- * triangle before the SG3_UNDEFINED_PROPERTY overwriting step;
- * - if not, a non-SG3_UNDEFINED_PROPERTY is only consistent with itself and
- * with SG3_UNDEFINED_PROPERTY (if inconsistent, merge_conflict_status is set
+ * triangle before the SG3_UNSPECIFIED_PROPERTY overwriting step;
+ * - if not, a non-SG3_UNSPECIFIED_PROPERTY is only consistent with itself and
+ * with SG3_UNSPECIFIED_PROPERTY (if inconsistent, merge_conflict_status is set
* to 1 and recorded) ; regardless of merge_conflict_status, a
- * non-SG3_UNDEFINED_PROPERTY property is never overridden.
+ * non-SG3_UNSPECIFIED_PROPERTY property is never overridden.
* When deduplicating triangles, the first occurence remains (with its
* original index in user world). After consistency being computed, a final
- * step consists in rewriting SG3_UNDEFINED_PROPERTY properties if the merged
+ * step consists in rewriting SG3_UNSPECIFIED_PROPERTY properties if the merged
* property is defined. */
SG3_API res_T
sg3_geometry_add
@@ -265,26 +267,26 @@ sg3_geometry_get_unique_vertex
/* Get the number of triangles added to the geometry, regardless of unicity. */
SG3_API res_T
-sg3_geometry_get_added_triangles_count
+sg3_geometry_get_added_primitives_count
(const struct sg3_geometry* geometry,
unsigned* count);
/* Get the number of unique triangles. */
SG3_API res_T
-sg3_geometry_get_unique_triangles_count
+sg3_geometry_get_unique_primitives_count
(const struct sg3_geometry* geometry,
unsigned* count);
/* Get the vertex indices of the itri_th unique triangle. */
SG3_API res_T
-sg3_geometry_get_unique_triangle_vertices
+sg3_geometry_get_unique_primitive_vertices
(const struct sg3_geometry* geometry,
const unsigned itri,
unsigned indices[3]);
/* Get the properties of the itri_th unique triangle. */
SG3_API res_T
-sg3_geometry_get_unique_triangle_properties
+sg3_geometry_get_unique_primitive_properties
(const struct sg3_geometry* geometry,
const unsigned itri,
unsigned properties[SG3_PROP_TYPES_COUNT__]);
@@ -295,33 +297,33 @@ sg3_geometry_get_unique_triangle_properties
* submitted to sg3_geometry_add calls, regardless of duplication or
* sg3_geometry_add failures (non-RES_OK return value). */
SG3_API res_T
-sg3_geometry_get_unique_triangle_user_id
+sg3_geometry_get_unique_primitive_user_id
(const struct sg3_geometry* geometry,
const unsigned itri,
unsigned* user_id);
-/* Get the number of triangle with (at least) one undefined side. */
+/* Get the number of triangles with (at least) one unspecified side. */
SG3_API res_T
-sg3_geometry_get_triangle_with_undefined_side_count
+sg3_geometry_get_unique_primitives_with_unspecified_side_count
(const struct sg3_geometry* geometry,
unsigned* count);
-/* Get the number of triangle with undefined interface. */
+/* Get the number of triangles with unspecified interface. */
SG3_API res_T
-sg3_geometry_get_triangle_with_undefined_interface_count
+sg3_geometry_get_unique_primitives_with_unspecified_interface_count
(const struct sg3_geometry* geometry,
unsigned* count);
-/* Get the number of triangle flagged with a merge conflict. */
+/* Get the number of triangles flagged with a merge conflict. */
SG3_API res_T
-sg3_geometry_get_merge_conflict_count
+sg3_geometry_get_unique_primitives_with_merge_conflict_count
(const struct sg3_geometry* geometry,
unsigned* count);
-/* Get the number of triangle flagged with a property conflict. Only meaningful
- * after sg3_geometry_validate_properties has been called. */
+/* Get the number of triangles flagged with a property conflict. Only
+ * meaningful after sg3_geometry_validate_properties has been called. */
SG3_API res_T
-sg3_geometry_get_properties_conflict_count
+sg3_geometry_get_unique_primitives_with_properties_conflict_count
(const struct sg3_geometry* geometry,
unsigned* count);
@@ -344,11 +346,11 @@ sg3_geometry_dump_as_obj
* The geometry can include conflicts, but cannot be empty.
* The dump is made of the vertices and triangles, with most of their
* properties:
- * - Front_medium (medium ID of the front side, INT_MAX for both undefined and
+ * - Front_medium (medium ID of the front side, INT_MAX for both unspecified
+ * and conflicted)
+ * - Back_medium (medium ID of the back side, INT_MAX for both unspecified and
* conflicted)
- * - Back_medium (medium ID of the back side, INT_MAX for both undefined and
- * conflicted)
- * - Interface (interface ID, INT_MAX for both undefined and conflicted)
+ * - Interface (interface ID, INT_MAX for both unspecified and conflicted)
* - Merge_conflict (merge conflict status)
* - Property_conflict (property conflict status)
* - Created_at_sg3_geometry_add (rank of the sg3_geometry_add that created the
@@ -370,7 +372,7 @@ sg3_geometry_dump_as_vtk
* The two qualifiers static and const are output or not according to flags;
* flags must be ORed enum sg3_cdump_qualifiers values. */
SG3_API res_T
-sg3_geometry_dump_as_C_code
+sg3_geometry_dump_as_c_code
(const struct sg3_geometry* geometry,
FILE* stream,
const char* name_prefix, /* Can be NULL or "" */
diff --git a/src/sg3_geometry.c b/src/sg3_geometry.c
@@ -109,7 +109,7 @@ dump_trg_property
descriptions
= darray_trg_descriptions_cdata_get(&geom->trg_descriptions);
FOR_EACH(i, 0, darray_triangle_size_get(&geom->unique_triangles)) {
- unsigned property = SG3_UNDEFINED_PROPERTY;
+ unsigned property = SG3_UNSPECIFIED_PROPERTY;
size_t tdefs_count
= darray_definition_size_get(&descriptions[i].defs[type]);
if(tdefs_count && descriptions[i].property_defined[type]) {
@@ -117,14 +117,14 @@ dump_trg_property
= darray_definition_cdata_get(&descriptions[i].defs[type]);
size_t j;
FOR_EACH(j, 0, tdefs_count) {
- if(tdefs->property_value != SG3_UNDEFINED_PROPERTY) {
+ if(tdefs->property_value != SG3_UNSPECIFIED_PROPERTY) {
property = tdefs->property_value;
break; /* Found the defined value */
}
tdefs++; /* Next value */
}
}
- /* Value is INT_MAX for both undefined and conflict */
+ /* In VTK dumps INT_MAX is used for both unspecified and conflict */
fprintf(stream, "%u\n", MMIN(property, INT_MAX));
}
}
@@ -157,8 +157,8 @@ geometry_register_triangle
int done = 0;
size_t j;
keep_prop_def[i] = trg_d->property_defined[i];
- if(triangle->properties[i] == SG3_UNDEFINED_PROPERTY)
- trg_d->defs_include_undefined = 1;
+ if(triangle->properties[i] == SG3_UNSPECIFIED_PROPERTY)
+ trg_d->defs_include_unspecified = 1;
else trg_d->property_defined[i] = 1;
definitions = trg_d->defs + i;
defs = darray_definition_data_get(definitions);
@@ -203,14 +203,14 @@ geometry_register_triangle
&& trg_d->property_defined[SG3_FRONT] && trg_d->property_defined[SG3_BACK])
{
/* Both sides are now defined */
- ASSERT(geom->trg_with_undef_sides_count > 0);
- geom->trg_with_undef_sides_count--;
+ ASSERT(geom->trg_with_unspecified_sides_count > 0);
+ geom->trg_with_unspecified_sides_count--;
}
if(!keep_prop_def[SG3_INTFACE] && trg_d->property_defined[SG3_INTFACE]) {
/* Interface is now defined */
- ASSERT(geom->trg_with_undef_intface_count > 0);
- geom->trg_with_undef_intface_count--;
+ ASSERT(geom->trg_with_unspecified_intface_count > 0);
+ geom->trg_with_unspecified_intface_count--;
}
exit:
@@ -230,8 +230,8 @@ geometry_enlarge_trg_descriptions
if(sz <= old_sz) return RES_OK;
ASSERT(sz - old_sz < UINT_MAX);
ERR(darray_trg_descriptions_resize(&geom->trg_descriptions, sz));
- geom->trg_with_undef_sides_count += (unsigned)(sz - old_sz);
- geom->trg_with_undef_intface_count += (unsigned)(sz - old_sz);
+ geom->trg_with_unspecified_sides_count += (unsigned)(sz - old_sz);
+ geom->trg_with_unspecified_intface_count += (unsigned)(sz - old_sz);
exit:
return res;
@@ -250,9 +250,9 @@ dump_partition
const struct triangle* triangles;
size_t sz, i;
ASSERT(geom && stream && group_name);
- ASSERT(partition == SG3_MERGE_CONFLICTS
- || partition == SG3_PROPERTY_CONFLICTS
- || partition == SG3_VALID_TRIANGLE);
+ ASSERT(partition == SG3_OBJ_DUMP_MERGE_CONFLICTS
+ || partition == SG3_OBJ_DUMP_PROPERTY_CONFLICTS
+ || partition == SG3_OBJ_DUMP_VALID_PRIMITIVE);
trg_descriptions
= darray_trg_descriptions_cdata_get(&geom->trg_descriptions);
sz = darray_trg_descriptions_size_get(&geom->trg_descriptions);
@@ -260,13 +260,13 @@ dump_partition
fprintf(stream, "g %s\n", group_name);
FOR_EACH(i, 0, sz) {
int dump;
- if(partition == SG3_VALID_TRIANGLE)
+ if(partition == SG3_OBJ_DUMP_VALID_PRIMITIVE)
dump = !(trg_descriptions[i].merge_conflict
|| trg_descriptions[i].properties_conflict);
- else if(partition == SG3_MERGE_CONFLICTS)
+ else if(partition == SG3_OBJ_DUMP_MERGE_CONFLICTS)
dump = trg_descriptions[i].merge_conflict;
else {
- ASSERT(partition == SG3_PROPERTY_CONFLICTS);
+ ASSERT(partition == SG3_OBJ_DUMP_PROPERTY_CONFLICTS);
dump = trg_descriptions[i].properties_conflict;
}
if(!dump) continue;
@@ -311,8 +311,8 @@ sg3_geometry_create
geom->triangle_count_including_duplicates = 0;
geom->sides_with_defined_medium_count = 0;
geom->set_id = 0;
- geom->trg_with_undef_sides_count = 0;
- geom->trg_with_undef_intface_count = 0;
+ geom->trg_with_unspecified_sides_count = 0;
+ geom->trg_with_unspecified_intface_count = 0;
geom->merge_conflict_count = 0;
geom->properties_conflict_count = 0;
geom->dev = dev;
@@ -487,10 +487,10 @@ sg3_geometry_add
}
if(trg_descriptions[i].merge_conflict && !already_conflict)
geom->merge_conflict_count++;
- /* Replace SG3_UNDEFINED_PROPERTY properties */
+ /* Replace SG3_UNSPECIFIED_PROPERTY properties */
FOR_EACH(j, 0, SG3_PROP_TYPES_COUNT__) {
- if(trg[*p_trg].properties[j] == SG3_UNDEFINED_PROPERTY
- && tmp.properties[j] != SG3_UNDEFINED_PROPERTY) {
+ if(trg[*p_trg].properties[j] == SG3_UNSPECIFIED_PROPERTY
+ && tmp.properties[j] != SG3_UNSPECIFIED_PROPERTY) {
trg[*p_trg].properties[j] = tmp.properties[j];
if(j == SG3_FRONT || j == SG3_BACK)
geom->sides_with_defined_medium_count++;
@@ -509,7 +509,7 @@ sg3_geometry_add
ERR(darray_triangle_push_back(&geom->unique_triangles, &tmp));
FOR_EACH(j, 0, SG3_PROP_TYPES_COUNT__) {
if((j == SG3_FRONT || j == SG3_BACK)
- && tmp.properties[j] != SG3_UNDEFINED_PROPERTY)
+ && tmp.properties[j] != SG3_UNSPECIFIED_PROPERTY)
geom->sides_with_defined_medium_count++;
}
ASSERT(unique_id == htable_trg_size_get(&geom->unique_triangles_ids));
@@ -572,9 +572,9 @@ sg3_geometry_validate_properties
/* Get properties for non-conflict triangles */
FOR_EACH(p, 0, SG3_PROP_TYPES_COUNT__) {
const struct definition* defs = darray_definition_cdata_get(trgd->defs + p);
- props[p] = SG3_UNDEFINED_PROPERTY;
+ props[p] = SG3_UNSPECIFIED_PROPERTY;
FOR_EACH(j, 0, darray_definition_size_get(trgd->defs + p)) {
- if(defs[j].property_value != SG3_UNDEFINED_PROPERTY) {
+ if(defs[j].property_value != SG3_UNSPECIFIED_PROPERTY) {
props[p] = defs[j].property_value;
break;
}
@@ -635,7 +635,7 @@ error:
}
res_T
-sg3_geometry_get_added_triangles_count
+sg3_geometry_get_added_primitives_count
(const struct sg3_geometry* geom,
unsigned* count)
{
@@ -652,7 +652,7 @@ error:
}
res_T
-sg3_geometry_get_unique_triangles_count
+sg3_geometry_get_unique_primitives_count
(const struct sg3_geometry* geom,
unsigned* count)
{
@@ -672,7 +672,7 @@ error:
}
res_T
-sg3_geometry_get_unique_triangle_vertices
+sg3_geometry_get_unique_primitive_vertices
(const struct sg3_geometry* geom,
const unsigned itri,
unsigned indices[3])
@@ -695,7 +695,7 @@ error:
}
res_T
-sg3_geometry_get_unique_triangle_properties
+sg3_geometry_get_unique_primitive_properties
(const struct sg3_geometry* geom,
const unsigned itri,
unsigned properties[SG3_PROP_TYPES_COUNT__])
@@ -719,7 +719,7 @@ error:
}
res_T
-sg3_geometry_get_unique_triangle_user_id
+sg3_geometry_get_unique_primitive_user_id
(const struct sg3_geometry* geom,
const unsigned itri,
unsigned* user_id)
@@ -741,7 +741,7 @@ error:
}
res_T
-sg3_geometry_get_triangle_with_undefined_side_count
+sg3_geometry_get_unique_primitives_with_unspecified_side_count
(const struct sg3_geometry* geom,
unsigned* count)
{
@@ -750,7 +750,7 @@ sg3_geometry_get_triangle_with_undefined_side_count
res = RES_BAD_ARG;
goto error;
}
- *count = geom->trg_with_undef_sides_count;
+ *count = geom->trg_with_unspecified_sides_count;
exit:
return res;
error:
@@ -758,7 +758,7 @@ error:
}
res_T
-sg3_geometry_get_triangle_with_undefined_interface_count
+sg3_geometry_get_unique_primitives_with_unspecified_interface_count
(const struct sg3_geometry* geom,
unsigned* count)
{
@@ -767,7 +767,7 @@ sg3_geometry_get_triangle_with_undefined_interface_count
res = RES_BAD_ARG;
goto error;
}
- *count = geom->trg_with_undef_intface_count;
+ *count = geom->trg_with_unspecified_intface_count;
exit:
return res;
error:
@@ -775,7 +775,7 @@ error:
}
res_T
-sg3_geometry_get_merge_conflict_count
+sg3_geometry_get_unique_primitives_with_merge_conflict_count
(const struct sg3_geometry* geom,
unsigned* count)
{
@@ -792,7 +792,7 @@ error:
}
res_T
-sg3_geometry_get_properties_conflict_count
+sg3_geometry_get_unique_primitives_with_properties_conflict_count
(const struct sg3_geometry* geom,
unsigned* count)
{
@@ -849,9 +849,9 @@ sg3_geometry_dump_as_obj
fprintf(stream, "v %g %g %g\n", SPLIT3(vertices[i].coord));
/* Dump triangles by groups */
- dump_partition(geom, stream, "Valid_triangles", SG3_VALID_TRIANGLE);
- dump_partition(geom, stream, "Merge_conflicts", SG3_MERGE_CONFLICTS);
- dump_partition(geom, stream, "Property_conflicts", SG3_PROPERTY_CONFLICTS);
+ dump_partition(geom, stream, "Valid_triangles", SG3_OBJ_DUMP_VALID_PRIMITIVE);
+ dump_partition(geom, stream, "Merge_conflicts", SG3_OBJ_DUMP_MERGE_CONFLICTS);
+ dump_partition(geom, stream, "Property_conflicts", SG3_OBJ_DUMP_PROPERTY_CONFLICTS);
exit:
return res;
@@ -956,7 +956,7 @@ error:
}
res_T
-sg3_geometry_dump_as_C_code
+sg3_geometry_dump_as_c_code
(const struct sg3_geometry* geom,
FILE* stream,
const char* name_prefix,
@@ -1004,11 +1004,11 @@ sg3_geometry_dump_as_C_code
goto error;
}
- if(flags & SG3_CDUMP_CONST && flags & SG3_CDUMP_STATIC)
+ if(flags & SG3_C_DUMP_CONST && flags & SG3_C_DUMP_STATIC)
qualifiers = "static const ";
- else if(flags & SG3_CDUMP_CONST)
+ else if(flags & SG3_C_DUMP_CONST)
qualifiers = "const ";
- else if(flags & SG3_CDUMP_STATIC)
+ else if(flags & SG3_C_DUMP_STATIC)
qualifiers = "static ";
else qualifiers = "";
@@ -1055,8 +1055,8 @@ sg3_geometry_dump_as_C_code
int p;
fprintf(stream, " ");
FOR_EACH(p, 0, SG3_PROP_TYPES_COUNT__) {
- if(triangles[i].properties[p] == SG3_UNDEFINED_PROPERTY)
- fprintf(stream, " SG3_UNDEFINED_PROPERTY");
+ if(triangles[i].properties[p] == SG3_UNSPECIFIED_PROPERTY)
+ fprintf(stream, " SG3_UNSPECIFIED_PROPERTY");
else fprintf(stream," %u", triangles[i].properties[p]);
if(i < tsz-1 || p < 2) fprintf(stream, ",");
if(p == 2) fprintf(stream, "\n");
diff --git a/src/sg3_geometry.h b/src/sg3_geometry.h
@@ -36,9 +36,9 @@ struct triangle {
unsigned user_id;
};
#define TRG_UNDEF__ {\
- { SG3_UNDEFINED_PROPERTY, SG3_UNDEFINED_PROPERTY, SG3_UNDEFINED_PROPERTY },\
- { SG3_UNDEFINED_PROPERTY, SG3_UNDEFINED_PROPERTY, SG3_UNDEFINED_PROPERTY },\
- SG3_UNDEFINED_PROPERTY\
+ { SG3_UNSPECIFIED_PROPERTY, SG3_UNSPECIFIED_PROPERTY, SG3_UNSPECIFIED_PROPERTY },\
+ { SG3_UNSPECIFIED_PROPERTY, SG3_UNSPECIFIED_PROPERTY, SG3_UNSPECIFIED_PROPERTY },\
+ SG3_UNSPECIFIED_PROPERTY\
}
#define DARRAY_NAME triangle
#define DARRAY_DATA struct triangle
@@ -113,7 +113,7 @@ init_definition
struct definition* data)
{
ASSERT(alloc && data);
- data->property_value = SG3_UNDEFINED_PROPERTY;
+ data->property_value = SG3_UNSPECIFIED_PROPERTY;
darray_uint_init(alloc, &data->set_ids);
}
@@ -153,7 +153,7 @@ struct trg_descriptions {
struct darray_definition defs[SG3_PROP_TYPES_COUNT__];
int merge_conflict;
int properties_conflict;
- char defs_include_undefined;
+ char defs_include_unspecified;
char property_defined[SG3_PROP_TYPES_COUNT__];
};
@@ -168,7 +168,7 @@ init_trg_descriptions
darray_definition_init(alloc, data->defs + i);
data->merge_conflict = 0;
data->properties_conflict = 0;
- data->defs_include_undefined = 0;
+ data->defs_include_unspecified = 0;
FOR_EACH(i, 0, SG3_PROP_TYPES_COUNT__)
data->property_defined[i] = 0;
}
@@ -185,7 +185,7 @@ copy_trg_descriptions
ERR(darray_definition_copy(&dst->defs[i], &src->defs[i]));
dst->merge_conflict = src->merge_conflict;
dst->properties_conflict = src->properties_conflict;
- dst->defs_include_undefined = src->defs_include_undefined;
+ dst->defs_include_unspecified = src->defs_include_unspecified;
FOR_EACH(i, 0, SG3_PROP_TYPES_COUNT__)
dst->property_defined[i] = src->property_defined[i];
exit:
@@ -220,7 +220,7 @@ init_trg_intfaceid
unsigned* data)
{
ASSERT(data); (void)alloc;
- *data = SG3_UNDEFINED_PROPERTY;
+ *data = SG3_UNSPECIFIED_PROPERTY;
}
#define DARRAY_NAME intface_id
@@ -249,8 +249,8 @@ struct sg3_geometry {
unsigned set_id;
unsigned triangle_count_including_duplicates;
unsigned sides_with_defined_medium_count;
- unsigned trg_with_undef_sides_count;
- unsigned trg_with_undef_intface_count;
+ unsigned trg_with_unspecified_sides_count;
+ unsigned trg_with_unspecified_intface_count;
unsigned merge_conflict_count;
unsigned properties_conflict_count;
diff --git a/src/sg3_s3d_helper.h b/src/sg3_s3d_helper.h
@@ -13,8 +13,8 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#ifndef SG3_SENC_WRAPPER_H__
-#define SG3_SENC_WRAPPER_H__
+#ifndef SG3_SENC_HELPER_H__
+#define SG3_SENC_HELPER_H__
#include "sg3.h"
#include <star/senc.h>
@@ -34,7 +34,7 @@ sg3_s3d_geometry_get_indices__
const struct sg3_geometry* geometry = ctx;
res_T r;
ASSERT(indices && geometry);
- r = sg3_geometry_get_unique_triangle_vertices(geometry, itri, indices);
+ r = sg3_geometry_get_unique_primitive_vertices(geometry, itri, indices);
ASSERT(r == RES_OK); (void)r;
}
@@ -58,4 +58,4 @@ sg3_s3d_geometry_get_position__
END_DECLS
-#endif /* SG3_SENC_WRAPPER_H__ */
+#endif /* SG3_SENC_HELPER_H__ */
diff --git a/src/sg3_senc_helper.h b/src/sg3_senc_helper.h
@@ -13,8 +13,8 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#ifndef SG3_SENC_WRAPPER_H__
-#define SG3_SENC_WRAPPER_H__
+#ifndef SG3_SENC_HELPER_H__
+#define SG3_SENC_HELPER_H__
#include "sg3.h"
#include <star/senc.h>
@@ -32,7 +32,7 @@ sg3_senc_geometry_get_indices__
const struct sg3_geometry* geometry = ctx;
res_T r;
ASSERT(indices && geometry);
- r = sg3_geometry_get_unique_triangle_vertices(geometry, itri, indices);
+ r = sg3_geometry_get_unique_primitive_vertices(geometry, itri, indices);
ASSERT(r == RES_OK); (void)r;
}
@@ -48,12 +48,12 @@ sg3_senc_geometry_get_media__
unsigned tmp[SG3_PROP_TYPES_COUNT__];
res_T r;
ASSERT(media && geometry);
- r = sg3_geometry_get_unique_triangle_properties(geometry, itri, tmp);
+ r = sg3_geometry_get_unique_primitive_properties(geometry, itri, tmp);
ASSERT(r == RES_OK); (void)r;
- media[SENC_FRONT] = (tmp[SG3_FRONT] == SG3_UNDEFINED_PROPERTY)
- ? SENC_UNDEFINED_MEDIUM : tmp[SG3_FRONT];
- media[SENC_BACK] = (tmp[SG3_BACK] == SG3_UNDEFINED_PROPERTY)
- ? SENC_UNDEFINED_MEDIUM : tmp[SG3_BACK];
+ media[SENC_FRONT] = (tmp[SG3_FRONT] == SG3_UNSPECIFIED_PROPERTY)
+ ? SENC_UNSPECIFIED_MEDIUM : tmp[SG3_FRONT];
+ media[SENC_BACK] = (tmp[SG3_BACK] == SG3_UNSPECIFIED_PROPERTY)
+ ? SENC_UNSPECIFIED_MEDIUM : tmp[SG3_BACK];
}
/* Get vertex indices for the itri_th triangle.
@@ -73,4 +73,4 @@ sg3_senc_geometry_get_position__
END_DECLS
-#endif /* SG3_SENC_WRAPPER_H__ */
+#endif /* SG3_SENC_HELPER_H__ */
diff --git a/src/test_sg3_cube_behind_cube.c b/src/test_sg3_cube_behind_cube.c
@@ -82,14 +82,14 @@ main(int argc, char** argv)
/* Second cube (front: 0, back: 1), right-handed normal outside */
OK(sg3_geometry_add(geom, ntriangles, nvertices, &callbacks, &ctx));
- OK(sg3_geometry_get_merge_conflict_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_with_merge_conflict_count(geom, &count));
CHK(count == 0);
- OK(sg3_geometry_get_triangle_with_undefined_interface_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_with_unspecified_interface_count(geom, &count));
CHK(count == 0);
- OK(sg3_geometry_get_triangle_with_undefined_side_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_with_unspecified_side_count(geom, &count));
CHK(count == 0);
- OK(sg3_geometry_dump_as_C_code(geom, stdout, "cube_behind_cube_2",
- SG3_CDUMP_CONST | SG3_CDUMP_STATIC));
+ OK(sg3_geometry_dump_as_c_code(geom, stdout, "cube_behind_cube_2",
+ SG3_C_DUMP_CONST | SG3_C_DUMP_STATIC));
d3(ctx.offset, -3, -3, 30);
ctx.scale = 7;
@@ -99,14 +99,14 @@ main(int argc, char** argv)
/* Third cube (front: 1, back: 0), right-handed normal outside */
OK(sg3_geometry_add(geom, ntriangles, nvertices, &callbacks, &ctx));
- OK(sg3_geometry_get_merge_conflict_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_with_merge_conflict_count(geom, &count));
CHK(count == 0);
- OK(sg3_geometry_get_triangle_with_undefined_interface_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_with_unspecified_interface_count(geom, &count));
CHK(count == 0);
- OK(sg3_geometry_get_triangle_with_undefined_side_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_with_unspecified_side_count(geom, &count));
CHK(count == 0);
- OK(sg3_geometry_dump_as_C_code(geom, stdout, "cube_behind_cube_3",
- SG3_CDUMP_CONST | SG3_CDUMP_STATIC));
+ OK(sg3_geometry_dump_as_c_code(geom, stdout, "cube_behind_cube_3",
+ SG3_C_DUMP_CONST | SG3_C_DUMP_STATIC));
SG3(geometry_ref_put(geom));
diff --git a/src/test_sg3_cube_in_cube.c b/src/test_sg3_cube_in_cube.c
@@ -73,14 +73,14 @@ main(int argc, char** argv)
/* Second cube (front: 0, back: 1), right-handed normal inside */
OK(sg3_geometry_add(geom, ntriangles, nvertices, &callbacks, &ctx));
- OK(sg3_geometry_get_merge_conflict_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_with_merge_conflict_count(geom, &count));
CHK(count == 0);
- OK(sg3_geometry_get_triangle_with_undefined_interface_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_with_unspecified_interface_count(geom, &count));
CHK(count == 0);
- OK(sg3_geometry_get_triangle_with_undefined_side_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_with_unspecified_side_count(geom, &count));
CHK(count == 0);
- OK(sg3_geometry_dump_as_C_code(geom, stdout, "cube_in_cube_2",
- SG3_CDUMP_CONST | SG3_CDUMP_STATIC));
+ OK(sg3_geometry_dump_as_c_code(geom, stdout, "cube_in_cube_2",
+ SG3_C_DUMP_CONST | SG3_C_DUMP_STATIC));
d3(ctx.offset, -4, -4, -4);
ctx.scale = 10;
@@ -92,14 +92,14 @@ main(int argc, char** argv)
/* Third cube (front: 0, back: 1), right-handed normal inside */
OK(sg3_geometry_add(geom, ntriangles, nvertices, &callbacks, &ctx));
- OK(sg3_geometry_get_merge_conflict_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_with_merge_conflict_count(geom, &count));
CHK(count == 0);
- OK(sg3_geometry_get_triangle_with_undefined_interface_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_with_unspecified_interface_count(geom, &count));
CHK(count == 0);
- OK(sg3_geometry_get_triangle_with_undefined_side_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_with_unspecified_side_count(geom, &count));
CHK(count == 0);
- OK(sg3_geometry_dump_as_C_code(geom, stdout, "cube_in_cube_3",
- SG3_CDUMP_CONST | SG3_CDUMP_STATIC));
+ OK(sg3_geometry_dump_as_c_code(geom, stdout, "cube_in_cube_3",
+ SG3_C_DUMP_CONST | SG3_C_DUMP_STATIC));
SG3(geometry_ref_put(geom));
diff --git a/src/test_sg3_cube_on_cube.c b/src/test_sg3_cube_on_cube.c
@@ -83,14 +83,14 @@ main(int argc, char** argv)
/* Third cube (front: 2, back: 1), right-handed normal inside */
OK(sg3_geometry_add(geom, ntriangles, nvertices, &callbacks, &ctx));
- OK(sg3_geometry_get_merge_conflict_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_with_merge_conflict_count(geom, &count));
CHK(count == 0);
- OK(sg3_geometry_get_triangle_with_undefined_interface_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_with_unspecified_interface_count(geom, &count));
CHK(count == 0);
- OK(sg3_geometry_get_triangle_with_undefined_side_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_with_unspecified_side_count(geom, &count));
CHK(count == 0);
- OK(sg3_geometry_dump_as_C_code(geom, stdout, "cube_on_cube",
- SG3_CDUMP_CONST | SG3_CDUMP_STATIC));
+ OK(sg3_geometry_dump_as_c_code(geom, stdout, "cube_on_cube",
+ SG3_C_DUMP_CONST | SG3_C_DUMP_STATIC));
SG3(geometry_ref_put(geom));
diff --git a/src/test_sg3_geometry.c b/src/test_sg3_geometry.c
@@ -102,45 +102,45 @@ main(int argc, char** argv)
BA(sg3_geometry_get_unique_vertices_count(NULL, &count));
OK(sg3_geometry_get_unique_vertices_count(geom, &count));
- BA(sg3_geometry_get_added_triangles_count(NULL, NULL));
- BA(sg3_geometry_get_added_triangles_count(geom, NULL));
- BA(sg3_geometry_get_added_triangles_count(NULL, &count));
- OK(sg3_geometry_get_added_triangles_count(geom, &count));
-
- BA(sg3_geometry_get_unique_triangles_count(NULL, NULL));
- BA(sg3_geometry_get_unique_triangles_count(geom, NULL));
- BA(sg3_geometry_get_unique_triangles_count(NULL, &count));
- OK(sg3_geometry_get_unique_triangles_count(geom, &count));
-
- BA(sg3_geometry_get_triangle_with_undefined_side_count(NULL, NULL));
- BA(sg3_geometry_get_triangle_with_undefined_side_count(geom, NULL));
- BA(sg3_geometry_get_triangle_with_undefined_side_count(NULL, &count));
- OK(sg3_geometry_get_triangle_with_undefined_side_count(geom, &count));
-
- BA(sg3_geometry_get_triangle_with_undefined_interface_count(NULL, NULL));
- BA(sg3_geometry_get_triangle_with_undefined_interface_count(geom, NULL));
- BA(sg3_geometry_get_triangle_with_undefined_interface_count(NULL, &count));
- OK(sg3_geometry_get_triangle_with_undefined_interface_count(geom, &count));
-
- BA(sg3_geometry_get_merge_conflict_count(NULL, NULL));
- BA(sg3_geometry_get_merge_conflict_count(geom, NULL));
- BA(sg3_geometry_get_merge_conflict_count(NULL, &count));
- OK(sg3_geometry_get_merge_conflict_count(geom, &count));
-
- BA(sg3_geometry_get_properties_conflict_count(NULL, NULL));
- BA(sg3_geometry_get_properties_conflict_count(geom, NULL));
- BA(sg3_geometry_get_properties_conflict_count(NULL, &count));
- OK(sg3_geometry_get_properties_conflict_count(geom, &count));
+ BA(sg3_geometry_get_added_primitives_count(NULL, NULL));
+ BA(sg3_geometry_get_added_primitives_count(geom, NULL));
+ BA(sg3_geometry_get_added_primitives_count(NULL, &count));
+ OK(sg3_geometry_get_added_primitives_count(geom, &count));
+
+ BA(sg3_geometry_get_unique_primitives_count(NULL, NULL));
+ BA(sg3_geometry_get_unique_primitives_count(geom, NULL));
+ BA(sg3_geometry_get_unique_primitives_count(NULL, &count));
+ OK(sg3_geometry_get_unique_primitives_count(geom, &count));
+
+ BA(sg3_geometry_get_unique_primitives_with_unspecified_side_count(NULL, NULL));
+ BA(sg3_geometry_get_unique_primitives_with_unspecified_side_count(geom, NULL));
+ BA(sg3_geometry_get_unique_primitives_with_unspecified_side_count(NULL, &count));
+ OK(sg3_geometry_get_unique_primitives_with_unspecified_side_count(geom, &count));
+
+ BA(sg3_geometry_get_unique_primitives_with_unspecified_interface_count(NULL, NULL));
+ BA(sg3_geometry_get_unique_primitives_with_unspecified_interface_count(geom, NULL));
+ BA(sg3_geometry_get_unique_primitives_with_unspecified_interface_count(NULL, &count));
+ OK(sg3_geometry_get_unique_primitives_with_unspecified_interface_count(geom, &count));
+
+ BA(sg3_geometry_get_unique_primitives_with_merge_conflict_count(NULL, NULL));
+ BA(sg3_geometry_get_unique_primitives_with_merge_conflict_count(geom, NULL));
+ BA(sg3_geometry_get_unique_primitives_with_merge_conflict_count(NULL, &count));
+ OK(sg3_geometry_get_unique_primitives_with_merge_conflict_count(geom, &count));
+
+ BA(sg3_geometry_get_unique_primitives_with_properties_conflict_count(NULL, NULL));
+ BA(sg3_geometry_get_unique_primitives_with_properties_conflict_count(geom, NULL));
+ BA(sg3_geometry_get_unique_primitives_with_properties_conflict_count(NULL, &count));
+ OK(sg3_geometry_get_unique_primitives_with_properties_conflict_count(geom, &count));
BA(sg3_geometry_dump_as_obj(NULL, NULL, 0));
BA(sg3_geometry_dump_as_obj(geom, NULL, 0));
BA(sg3_geometry_dump_as_obj(NULL, stdout, 0));
- BA(sg3_geometry_dump_as_obj(NULL, NULL, SG3_ALL_TRIANGLES));
+ BA(sg3_geometry_dump_as_obj(NULL, NULL, SG3_OBJ_DUMP_ALL));
BA(sg3_geometry_dump_as_obj(geom, stdout, 0));
- BA(sg3_geometry_dump_as_obj(geom, NULL, SG3_ALL_TRIANGLES));
- BA(sg3_geometry_dump_as_obj(NULL, stdout, SG3_ALL_TRIANGLES));
+ BA(sg3_geometry_dump_as_obj(geom, NULL, SG3_OBJ_DUMP_ALL));
+ BA(sg3_geometry_dump_as_obj(NULL, stdout, SG3_OBJ_DUMP_ALL));
/* BA because geometry is empty */
- BA(sg3_geometry_dump_as_obj(geom, stdout, SG3_ALL_TRIANGLES));
+ BA(sg3_geometry_dump_as_obj(geom, stdout, SG3_OBJ_DUMP_ALL));
BA(sg3_geometry_dump_as_vtk(NULL, NULL));
BA(sg3_geometry_dump_as_vtk(geom, NULL));
@@ -148,21 +148,21 @@ main(int argc, char** argv)
/* BA because geometry is empty */
BA(sg3_geometry_dump_as_vtk(geom, stdout));
- BA(sg3_geometry_dump_as_C_code(NULL, NULL, NULL, 0));
- BA(sg3_geometry_dump_as_C_code(geom, NULL, NULL, 0));
- BA(sg3_geometry_dump_as_C_code(NULL, stdout, NULL, 0));
- BA(sg3_geometry_dump_as_C_code(NULL, NULL, "test", 0));
- BA(sg3_geometry_dump_as_C_code(geom, NULL, "test", 0));
- BA(sg3_geometry_dump_as_C_code(NULL, stdout, "test", 0));
+ BA(sg3_geometry_dump_as_c_code(NULL, NULL, NULL, 0));
+ BA(sg3_geometry_dump_as_c_code(geom, NULL, NULL, 0));
+ BA(sg3_geometry_dump_as_c_code(NULL, stdout, NULL, 0));
+ BA(sg3_geometry_dump_as_c_code(NULL, NULL, "test", 0));
+ BA(sg3_geometry_dump_as_c_code(geom, NULL, "test", 0));
+ BA(sg3_geometry_dump_as_c_code(NULL, stdout, "test", 0));
/* BA because geometry is empty */
- BA(sg3_geometry_dump_as_C_code(geom, stdout, NULL, 0));
- BA(sg3_geometry_dump_as_C_code(geom, stdout, "test", 0));
+ BA(sg3_geometry_dump_as_c_code(geom, stdout, NULL, 0));
+ BA(sg3_geometry_dump_as_c_code(geom, stdout, "test", 0));
BA(sg3_geometry_add(NULL, 0, 0, &callbacks, NULL));
- OK(sg3_geometry_get_added_triangles_count(geom, &count));
+ OK(sg3_geometry_get_added_primitives_count(geom, &count));
CHK(count == 0);
BA(sg3_geometry_add(geom, ntriangles, nvertices, NULL, NULL));
- OK(sg3_geometry_get_added_triangles_count(geom, &count));
+ OK(sg3_geometry_get_added_primitives_count(geom, &count));
CHK(count == ntriangles);
/* Mandatory callbacks are NULL */
callbacks.get_indices = NULL;
@@ -178,7 +178,7 @@ main(int argc, char** argv)
callbacks.get_indices = get_indices;
callbacks.get_position = get_position;
OK(sg3_geometry_add(geom, 0, 0, &callbacks, NULL));
- OK(sg3_geometry_get_added_triangles_count(geom, &count));
+ OK(sg3_geometry_get_added_primitives_count(geom, &count));
CHK(count == ntriangles);
/* A 3D cube.
@@ -195,11 +195,11 @@ main(int argc, char** argv)
callbacks.get_position = get_position;
OK(sg3_geometry_add(geom, ntriangles, nvertices, &callbacks, &ctx));
- OK(sg3_geometry_dump_as_obj(geom, stdout, SG3_ALL_TRIANGLES));
+ OK(sg3_geometry_dump_as_obj(geom, stdout, SG3_OBJ_DUMP_ALL));
OK(sg3_geometry_dump_as_vtk(geom, stdout));
- OK(sg3_geometry_dump_as_C_code(geom, stdout, NULL, 0));
- OK(sg3_geometry_dump_as_C_code(geom, stdout, "test",
- SG3_CDUMP_STATIC | SG3_CDUMP_CONST));
+ OK(sg3_geometry_dump_as_c_code(geom, stdout, NULL, 0));
+ OK(sg3_geometry_dump_as_c_code(geom, stdout, "test",
+ SG3_C_DUMP_STATIC | SG3_C_DUMP_CONST));
BA(sg3_geometry_get_unique_vertex(NULL, ntriangles, NULL));
BA(sg3_geometry_get_unique_vertex(geom, ntriangles, NULL));
@@ -210,36 +210,36 @@ main(int argc, char** argv)
BA(sg3_geometry_get_unique_vertex(NULL, 0, coord));
OK(sg3_geometry_get_unique_vertex(geom, 0, coord));
- BA(sg3_geometry_get_unique_triangle_vertices(NULL, ntriangles, NULL));
- BA(sg3_geometry_get_unique_triangle_vertices(geom, ntriangles, NULL));
- BA(sg3_geometry_get_unique_triangle_vertices(NULL, 0, NULL));
- BA(sg3_geometry_get_unique_triangle_vertices(NULL, ntriangles, indices));
- BA(sg3_geometry_get_unique_triangle_vertices(geom, 0, NULL));
- BA(sg3_geometry_get_unique_triangle_vertices(geom, ntriangles, indices));
- BA(sg3_geometry_get_unique_triangle_vertices(NULL, 0, indices));
- OK(sg3_geometry_get_unique_triangle_vertices(geom, 0, indices));
+ BA(sg3_geometry_get_unique_primitive_vertices(NULL, ntriangles, NULL));
+ BA(sg3_geometry_get_unique_primitive_vertices(geom, ntriangles, NULL));
+ BA(sg3_geometry_get_unique_primitive_vertices(NULL, 0, NULL));
+ BA(sg3_geometry_get_unique_primitive_vertices(NULL, ntriangles, indices));
+ BA(sg3_geometry_get_unique_primitive_vertices(geom, 0, NULL));
+ BA(sg3_geometry_get_unique_primitive_vertices(geom, ntriangles, indices));
+ BA(sg3_geometry_get_unique_primitive_vertices(NULL, 0, indices));
+ OK(sg3_geometry_get_unique_primitive_vertices(geom, 0, indices));
FOR_EACH(i, 0 , 3) CHK(indices[i] == cube_indices[i]);
- BA(sg3_geometry_get_unique_triangle_properties(NULL, ntriangles, NULL));
- BA(sg3_geometry_get_unique_triangle_properties(geom, ntriangles, NULL));
- BA(sg3_geometry_get_unique_triangle_properties(NULL, 0, NULL));
- BA(sg3_geometry_get_unique_triangle_properties(NULL, ntriangles, properties));
- BA(sg3_geometry_get_unique_triangle_properties(geom, 0, NULL));
- BA(sg3_geometry_get_unique_triangle_properties(geom, ntriangles, properties));
- BA(sg3_geometry_get_unique_triangle_properties(NULL, 0, properties));
- OK(sg3_geometry_get_unique_triangle_properties(geom, 0, properties));
+ BA(sg3_geometry_get_unique_primitive_properties(NULL, ntriangles, NULL));
+ BA(sg3_geometry_get_unique_primitive_properties(geom, ntriangles, NULL));
+ BA(sg3_geometry_get_unique_primitive_properties(NULL, 0, NULL));
+ BA(sg3_geometry_get_unique_primitive_properties(NULL, ntriangles, properties));
+ BA(sg3_geometry_get_unique_primitive_properties(geom, 0, NULL));
+ BA(sg3_geometry_get_unique_primitive_properties(geom, ntriangles, properties));
+ BA(sg3_geometry_get_unique_primitive_properties(NULL, 0, properties));
+ OK(sg3_geometry_get_unique_primitive_properties(geom, 0, properties));
CHK(medium0[0] == properties[SG3_FRONT]);
CHK(medium1[0] == properties[SG3_BACK]);
CHK(intface0[0] == properties[SG3_INTFACE]);
- BA(sg3_geometry_get_unique_triangle_user_id(NULL, ntriangles, NULL));
- BA(sg3_geometry_get_unique_triangle_user_id(geom, ntriangles, NULL));
- BA(sg3_geometry_get_unique_triangle_user_id(NULL, 0, NULL));
- BA(sg3_geometry_get_unique_triangle_user_id(NULL, ntriangles, &user_id));
- BA(sg3_geometry_get_unique_triangle_user_id(geom, 0, NULL));
- BA(sg3_geometry_get_unique_triangle_user_id(geom, ntriangles, &user_id));
- BA(sg3_geometry_get_unique_triangle_user_id(NULL, 0, &user_id));
- OK(sg3_geometry_get_unique_triangle_user_id(geom, 0, &user_id));
+ BA(sg3_geometry_get_unique_primitive_user_id(NULL, ntriangles, NULL));
+ BA(sg3_geometry_get_unique_primitive_user_id(geom, ntriangles, NULL));
+ BA(sg3_geometry_get_unique_primitive_user_id(NULL, 0, NULL));
+ BA(sg3_geometry_get_unique_primitive_user_id(NULL, ntriangles, &user_id));
+ BA(sg3_geometry_get_unique_primitive_user_id(geom, 0, NULL));
+ BA(sg3_geometry_get_unique_primitive_user_id(geom, ntriangles, &user_id));
+ BA(sg3_geometry_get_unique_primitive_user_id(NULL, 0, &user_id));
+ OK(sg3_geometry_get_unique_primitive_user_id(geom, 0, &user_id));
/* Due to a failed attempt to add ntriangles triangles, user_id for the
* first successfully added triangle is shifted */
CHK(user_id == ntriangles);
@@ -247,13 +247,13 @@ main(int argc, char** argv)
/* Conflicts with merge_trg callback */
callbacks.merge_triangle = merge_trg;
OK(sg3_geometry_add(geom, ntriangles, nvertices, &callbacks, &ctx));
- OK(sg3_geometry_get_merge_conflict_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_with_merge_conflict_count(geom, &count));
/* Due to merge_trg internals, all but the first triangle have conflict */
CHK(count == ntriangles - 1);
- OK(sg3_geometry_dump_as_obj(geom, stdout, SG3_ALL_TRIANGLES));
+ OK(sg3_geometry_dump_as_obj(geom, stdout, SG3_OBJ_DUMP_ALL));
OK(sg3_geometry_dump_as_vtk(geom, stdout));
/* BA because of conflicts */
- BA(sg3_geometry_dump_as_C_code(geom, stdout, "test", SG3_CDUMP_STATIC));
+ BA(sg3_geometry_dump_as_c_code(geom, stdout, "test", SG3_C_DUMP_STATIC));
OK(sg3_geometry_ref_put(geom));
/* Conflicts without merge_trg callback */
@@ -262,13 +262,13 @@ main(int argc, char** argv)
OK(sg3_geometry_add(geom, ntriangles, nvertices, &callbacks, &ctx));
ctx.front_media = medium1_front0;
OK(sg3_geometry_add(geom, ntriangles, nvertices, &callbacks, &ctx));
- OK(sg3_geometry_get_merge_conflict_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_with_merge_conflict_count(geom, &count));
FOR_EACH(i, 0, ntriangles) if(medium0[i] != medium1_front0[i]) count--;
CHK(count == 0);
- OK(sg3_geometry_dump_as_obj(geom, stdout, SG3_ALL_TRIANGLES));
+ OK(sg3_geometry_dump_as_obj(geom, stdout, SG3_OBJ_DUMP_ALL));
OK(sg3_geometry_dump_as_vtk(geom, stdout));
/* BA because of conflicts */
- BA(sg3_geometry_dump_as_C_code(geom, stdout, "test", SG3_CDUMP_CONST));
+ BA(sg3_geometry_dump_as_c_code(geom, stdout, "test", SG3_C_DUMP_CONST));
/* Degenerated triangles */
ctx.indices = degenerated;
diff --git a/src/test_sg3_geometry_2.c b/src/test_sg3_geometry_2.c
@@ -116,7 +116,7 @@ main(int argc, char** argv)
add_geom_ctx.add_res = add_geom_ctx.merge_res = RES_OK;
/* Geometry with no media information on both sides */
- for(i = 0; i < property_count; i++) property[i] = SG3_UNDEFINED_PROPERTY;
+ for(i = 0; i < property_count; i++) property[i] = SG3_UNSPECIFIED_PROPERTY;
ctx.front_media = property;
ctx.back_media = property;
ctx.intface = property;
@@ -134,25 +134,25 @@ main(int argc, char** argv)
CHK(add_geom_ctx.add_cpt == 0);
OK(sg3_geometry_get_unique_vertices_count(geom, &count));
CHK(count == nvertices);
- OK(sg3_geometry_get_added_triangles_count(geom, &count));
+ OK(sg3_geometry_get_added_primitives_count(geom, &count));
CHK(count == ntriangles);
- OK(sg3_geometry_get_unique_triangles_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_count(geom, &count));
CHK(count == 0);
add_geom_ctx.add_res = RES_MEM_ERR;
ME(sg3_geometry_add(geom, ntriangles, nvertices, &callbacks, &ctx));
CHK(add_geom_ctx.add_cpt == 0);
CHK(count == 0);
- OK(sg3_geometry_get_added_triangles_count(geom, &count));
+ OK(sg3_geometry_get_added_primitives_count(geom, &count));
CHK(count == 2 * ntriangles);
- OK(sg3_geometry_get_unique_triangles_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_count(geom, &count));
CHK(count == 0);
- OK(sg3_geometry_get_triangle_with_undefined_side_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_with_unspecified_side_count(geom, &count));
CHK(count == 0);
- OK(sg3_geometry_get_triangle_with_undefined_interface_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_with_unspecified_interface_count(geom, &count));
CHK(count == 0);
- OK(sg3_geometry_get_merge_conflict_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_with_merge_conflict_count(geom, &count));
CHK(count == 0);
- OK(sg3_geometry_get_properties_conflict_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_with_properties_conflict_count(geom, &count));
CHK(count == 0);
/* Successful add geometry with add callback */
@@ -162,21 +162,21 @@ main(int argc, char** argv)
CHK(add_geom_ctx.merge_cpt == 0);
OK(sg3_geometry_get_unique_vertices_count(geom, &count));
CHK(count == nvertices);
- OK(sg3_geometry_get_added_triangles_count(geom, &count));
+ OK(sg3_geometry_get_added_primitives_count(geom, &count));
CHK(count == 3 * ntriangles);
- OK(sg3_geometry_get_unique_triangles_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_count(geom, &count));
CHK(count == ntriangles);
- OK(sg3_geometry_get_triangle_with_undefined_side_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_with_unspecified_side_count(geom, &count));
CHK(count == ntriangles);
- OK(sg3_geometry_get_triangle_with_undefined_interface_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_with_unspecified_interface_count(geom, &count));
CHK(count == ntriangles);
- OK(sg3_geometry_get_merge_conflict_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_with_merge_conflict_count(geom, &count));
CHK(count == 0);
- OK(sg3_geometry_get_properties_conflict_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_with_properties_conflict_count(geom, &count));
CHK(count == 0);
- OK(sg3_geometry_dump_as_C_code(geom, stdout, "test_undefined",
- SG3_CDUMP_STATIC | SG3_CDUMP_CONST));
+ OK(sg3_geometry_dump_as_c_code(geom, stdout, "test_unspecified",
+ SG3_C_DUMP_STATIC | SG3_C_DUMP_CONST));
/* Clear geometry */
SG3(geometry_ref_put(geom));
@@ -190,17 +190,17 @@ main(int argc, char** argv)
CHK(add_geom_ctx.merge_cpt == 0);
OK(sg3_geometry_get_unique_vertices_count(geom, &count));
CHK(count == nvertices);
- OK(sg3_geometry_get_added_triangles_count(geom, &count));
+ OK(sg3_geometry_get_added_primitives_count(geom, &count));
CHK(count == ntriangles);
- OK(sg3_geometry_get_unique_triangles_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_count(geom, &count));
CHK(count == ntriangles);
- OK(sg3_geometry_get_triangle_with_undefined_side_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_with_unspecified_side_count(geom, &count));
CHK(count == ntriangles);
- OK(sg3_geometry_get_triangle_with_undefined_interface_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_with_unspecified_interface_count(geom, &count));
CHK(count == ntriangles);
- OK(sg3_geometry_get_merge_conflict_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_with_merge_conflict_count(geom, &count));
CHK(count == 0);
- OK(sg3_geometry_get_properties_conflict_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_with_properties_conflict_count(geom, &count));
CHK(count == 0);
/* If merge fails, add geometry fails the same way */
@@ -208,24 +208,24 @@ main(int argc, char** argv)
callbacks.add_triangle = add_trg;
BA(sg3_geometry_add(geom, ntriangles, nvertices, &callbacks, &ctx));
CHK(add_geom_ctx.merge_cpt == 0);
- OK(sg3_geometry_get_added_triangles_count(geom, &count));
+ OK(sg3_geometry_get_added_primitives_count(geom, &count));
CHK(count == 2 * ntriangles);
add_geom_ctx.merge_res = RES_MEM_ERR;
ME(sg3_geometry_add(geom, ntriangles, nvertices, &callbacks, &ctx));
CHK(add_geom_ctx.merge_cpt == 0);
- OK(sg3_geometry_get_added_triangles_count(geom, &count));
+ OK(sg3_geometry_get_added_primitives_count(geom, &count));
CHK(count == 3 * ntriangles);
OK(sg3_geometry_get_unique_vertices_count(geom, &count));
CHK(count == nvertices);
- OK(sg3_geometry_get_unique_triangles_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_count(geom, &count));
CHK(count == ntriangles);
- OK(sg3_geometry_get_triangle_with_undefined_side_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_with_unspecified_side_count(geom, &count));
CHK(count == ntriangles);
- OK(sg3_geometry_get_triangle_with_undefined_interface_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_with_unspecified_interface_count(geom, &count));
CHK(count == ntriangles);
- OK(sg3_geometry_get_merge_conflict_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_with_merge_conflict_count(geom, &count));
CHK(count == 0); /* merge failed but with a no-conflict status */
- OK(sg3_geometry_get_properties_conflict_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_with_properties_conflict_count(geom, &count));
CHK(count == 0);
/* Successful add geometry without merge callback */
@@ -234,17 +234,17 @@ main(int argc, char** argv)
CHK(add_geom_ctx.merge_cpt == 0);
OK(sg3_geometry_get_unique_vertices_count(geom, &count));
CHK(count == nvertices);
- OK(sg3_geometry_get_added_triangles_count(geom, &count));
+ OK(sg3_geometry_get_added_primitives_count(geom, &count));
CHK(count == 4 * ntriangles);
- OK(sg3_geometry_get_unique_triangles_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_count(geom, &count));
CHK(count == ntriangles);
- OK(sg3_geometry_get_triangle_with_undefined_side_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_with_unspecified_side_count(geom, &count));
CHK(count == ntriangles);
- OK(sg3_geometry_get_triangle_with_undefined_interface_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_with_unspecified_interface_count(geom, &count));
CHK(count == ntriangles);
- OK(sg3_geometry_get_merge_conflict_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_with_merge_conflict_count(geom, &count));
CHK(count == 0);
- OK(sg3_geometry_get_properties_conflict_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_with_properties_conflict_count(geom, &count));
CHK(count == 0);
/* Successful add geometry with merge callback */
@@ -255,17 +255,17 @@ main(int argc, char** argv)
add_geom_ctx.merge_cpt = 0;
OK(sg3_geometry_get_unique_vertices_count(geom, &count));
CHK(count == nvertices);
- OK(sg3_geometry_get_added_triangles_count(geom, &count));
+ OK(sg3_geometry_get_added_primitives_count(geom, &count));
CHK(count == 5 * ntriangles);
- OK(sg3_geometry_get_unique_triangles_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_count(geom, &count));
CHK(count == ntriangles);
- OK(sg3_geometry_get_triangle_with_undefined_side_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_with_unspecified_side_count(geom, &count));
CHK(count == ntriangles);
- OK(sg3_geometry_get_triangle_with_undefined_interface_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_with_unspecified_interface_count(geom, &count));
CHK(count == ntriangles);
- OK(sg3_geometry_get_merge_conflict_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_with_merge_conflict_count(geom, &count));
CHK(count == 0); /* merge failed but with a no-conflict status */
- OK(sg3_geometry_get_properties_conflict_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_with_properties_conflict_count(geom, &count));
CHK(count == 0);
/* Geometry with media information on both sides */
@@ -280,31 +280,31 @@ main(int argc, char** argv)
* First half of the triangles, then all of them */
add_geom_ctx.add_res = RES_OK;
OK(sg3_geometry_add(geom, ntriangles / 2, nvertices, &callbacks, &ctx));
- OK(sg3_geometry_get_added_triangles_count(geom, &count));
+ OK(sg3_geometry_get_added_primitives_count(geom, &count));
CHK(count == ntriangles / 2);
OK(sg3_geometry_add(geom, ntriangles, nvertices, &callbacks, &ctx));
CHK(add_geom_ctx.add_cpt == ntriangles);
CHK(add_geom_ctx.merge_cpt == ntriangles / 2);
add_geom_ctx.add_cpt = 0;
- OK(sg3_geometry_get_added_triangles_count(geom, &count));
+ OK(sg3_geometry_get_added_primitives_count(geom, &count));
CHK(count == ntriangles + ntriangles / 2);
OK(sg3_geometry_get_unique_vertices_count(geom, &count));
CHK(count == nvertices);
- OK(sg3_geometry_get_unique_triangles_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_count(geom, &count));
CHK(count == ntriangles);
- OK(sg3_geometry_get_triangle_with_undefined_side_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_with_unspecified_side_count(geom, &count));
CHK(count == 0); /* media where defined */
- OK(sg3_geometry_get_triangle_with_undefined_interface_count(geom, &count));
- CHK(count == ntriangles); /* interfaces where undefined */
- OK(sg3_geometry_get_merge_conflict_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_with_unspecified_interface_count(geom, &count));
+ CHK(count == ntriangles); /* interfaces where unspecified */
+ OK(sg3_geometry_get_unique_primitives_with_merge_conflict_count(geom, &count));
CHK(count == 0);
- OK(sg3_geometry_get_properties_conflict_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_with_properties_conflict_count(geom, &count));
CHK(count == 0);
OK(sg3_geometry_dump_as_vtk(geom, stdout));
/* Second add was half duplicated, so numbering is shifted */
FOR_EACH(i, 0, ntriangles) {
unsigned id;
- OK(sg3_geometry_get_unique_triangle_user_id(geom, i, &id));
+ OK(sg3_geometry_get_unique_primitive_user_id(geom, i, &id));
CHK(i < ntriangles / 2 ? id == i : id == i + ntriangles / 2);
}
@@ -322,17 +322,17 @@ main(int argc, char** argv)
add_geom_ctx.add_cpt = 0;
OK(sg3_geometry_get_unique_vertices_count(geom, &count));
CHK(count == nvertices);
- OK(sg3_geometry_get_added_triangles_count(geom, &count));
+ OK(sg3_geometry_get_added_primitives_count(geom, &count));
CHK(count == ntriangles);
- OK(sg3_geometry_get_unique_triangles_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_count(geom, &count));
CHK(count == ntriangles);
- OK(sg3_geometry_get_triangle_with_undefined_side_count(geom, &count));
- CHK(count == ntriangles); /* media where undefined */
- OK(sg3_geometry_get_triangle_with_undefined_interface_count(geom, &count));
- CHK(count == ntriangles); /* interfaces where undefined */
- OK(sg3_geometry_get_merge_conflict_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_with_unspecified_side_count(geom, &count));
+ CHK(count == ntriangles); /* media where unspecified */
+ OK(sg3_geometry_get_unique_primitives_with_unspecified_interface_count(geom, &count));
+ CHK(count == ntriangles); /* interfaces where unspecified */
+ OK(sg3_geometry_get_unique_primitives_with_merge_conflict_count(geom, &count));
CHK(count == 0);
- OK(sg3_geometry_get_properties_conflict_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_with_properties_conflict_count(geom, &count));
CHK(count == 0);
/* Define interface */
@@ -346,17 +346,17 @@ main(int argc, char** argv)
add_geom_ctx.merge_cpt = 0;
OK(sg3_geometry_get_unique_vertices_count(geom, &count));
CHK(count == nvertices);
- OK(sg3_geometry_get_added_triangles_count(geom, &count));
+ OK(sg3_geometry_get_added_primitives_count(geom, &count));
CHK(count == 2 * ntriangles);
- OK(sg3_geometry_get_unique_triangles_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_count(geom, &count));
CHK(count == ntriangles);
- OK(sg3_geometry_get_triangle_with_undefined_side_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_with_unspecified_side_count(geom, &count));
CHK(count == 0); /* media where defined */
- OK(sg3_geometry_get_triangle_with_undefined_interface_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_with_unspecified_interface_count(geom, &count));
CHK(count == 0); /* interfaces where defined */
- OK(sg3_geometry_get_merge_conflict_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_with_merge_conflict_count(geom, &count));
CHK(count == 0);
- OK(sg3_geometry_get_properties_conflict_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_with_properties_conflict_count(geom, &count));
CHK(count == 0);
/* Geometry with incompatible media information on both sides */
@@ -369,17 +369,17 @@ main(int argc, char** argv)
CHK(add_geom_ctx.merge_cpt == 0);
OK(sg3_geometry_get_unique_vertices_count(geom, &count));
CHK(count == nvertices);
- OK(sg3_geometry_get_added_triangles_count(geom, &count));
+ OK(sg3_geometry_get_added_primitives_count(geom, &count));
CHK(count == 3 * ntriangles);
- OK(sg3_geometry_get_unique_triangles_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_count(geom, &count));
CHK(count == ntriangles);
- OK(sg3_geometry_get_triangle_with_undefined_side_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_with_unspecified_side_count(geom, &count));
CHK(count == 0); /* media where defined */
- OK(sg3_geometry_get_triangle_with_undefined_interface_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_with_unspecified_interface_count(geom, &count));
CHK(count == 0); /* interfaces where defined */
- OK(sg3_geometry_get_merge_conflict_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_with_merge_conflict_count(geom, &count));
CHK(count == ntriangles);
- OK(sg3_geometry_get_properties_conflict_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_with_properties_conflict_count(geom, &count));
CHK(count == 0);
/* Incompatible interface */
@@ -393,17 +393,17 @@ main(int argc, char** argv)
add_geom_ctx.merge_cpt = 0;
OK(sg3_geometry_get_unique_vertices_count(geom, &count));
CHK(count == nvertices);
- OK(sg3_geometry_get_added_triangles_count(geom, &count));
+ OK(sg3_geometry_get_added_primitives_count(geom, &count));
CHK(count == 4 * ntriangles);
- OK(sg3_geometry_get_unique_triangles_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_count(geom, &count));
CHK(count == ntriangles);
- OK(sg3_geometry_get_triangle_with_undefined_side_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_with_unspecified_side_count(geom, &count));
CHK(count == 0); /* media where defined */
- OK(sg3_geometry_get_triangle_with_undefined_interface_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_with_unspecified_interface_count(geom, &count));
CHK(count == 0); /* interfaces where defined */
- OK(sg3_geometry_get_merge_conflict_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_with_merge_conflict_count(geom, &count));
CHK(count == ntriangles);
- OK(sg3_geometry_get_properties_conflict_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_with_properties_conflict_count(geom, &count));
CHK(count == 0);
/* Clear geometry */
@@ -412,20 +412,20 @@ main(int argc, char** argv)
/* Successful add geometry with merge callback */
OK(sg3_geometry_add(geom, ntriangles, nvertices, &callbacks, &ctx));
- OK(sg3_geometry_get_merge_conflict_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_with_merge_conflict_count(geom, &count));
CHK(count == 0);
OK(sg3_geometry_validate_properties(geom, validate, NULL));
- OK(sg3_geometry_get_properties_conflict_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_with_properties_conflict_count(geom, &count));
CHK(count == 0);
- OK(sg3_geometry_dump_as_obj(geom, stdout, SG3_ALL_TRIANGLES));
+ OK(sg3_geometry_dump_as_obj(geom, stdout, SG3_OBJ_DUMP_ALL));
OK(sg3_geometry_validate_properties(geom, validate, NULL));
- OK(sg3_geometry_get_properties_conflict_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_with_properties_conflict_count(geom, &count));
CHK(count == 0);
OK(sg3_geometry_validate_properties(geom, validate2, NULL));
- OK(sg3_geometry_get_properties_conflict_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_with_properties_conflict_count(geom, &count));
CHK(count == ntriangles / 2);
OK(sg3_geometry_ref_put(geom));
diff --git a/src/test_sg3_many_enclosures.c b/src/test_sg3_many_enclosures.c
@@ -88,13 +88,13 @@ main(int argc, char** argv)
}
S3DUT(mesh_ref_put(cyl));
- OK(sg3_geometry_get_merge_conflict_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_with_merge_conflict_count(geom, &count));
CHK(count == 0);
- OK(sg3_geometry_get_triangle_with_undefined_interface_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_with_unspecified_interface_count(geom, &count));
CHK(count == 0);
- OK(sg3_geometry_get_triangle_with_undefined_side_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_with_unspecified_side_count(geom, &count));
CHK(count == 0);
- OK(sg3_geometry_dump_as_obj(geom, stdout, SG3_ALL_TRIANGLES));
+ OK(sg3_geometry_dump_as_obj(geom, stdout, SG3_OBJ_DUMP_ALL));
SG3(geometry_ref_put(geom));
diff --git a/src/test_sg3_many_triangles.c b/src/test_sg3_many_triangles.c
@@ -69,13 +69,13 @@ main(int argc, char** argv)
}
S3DUT(mesh_ref_put(cyl));
- OK(sg3_geometry_get_merge_conflict_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_with_merge_conflict_count(geom, &count));
CHK(count == 0);
- OK(sg3_geometry_get_triangle_with_undefined_interface_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_with_unspecified_interface_count(geom, &count));
CHK(count == 0);
- OK(sg3_geometry_get_triangle_with_undefined_side_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_with_unspecified_side_count(geom, &count));
CHK(count == 0);
- OK(sg3_geometry_dump_as_obj(geom, stdout, SG3_ALL_TRIANGLES));
+ OK(sg3_geometry_dump_as_obj(geom, stdout, SG3_OBJ_DUMP_ALL));
SG3(geometry_ref_put(geom));
diff --git a/src/test_sg3_some_enclosures.c b/src/test_sg3_some_enclosures.c
@@ -88,14 +88,14 @@ main(int argc, char** argv)
}
S3DUT(mesh_ref_put(cyl));
- OK(sg3_geometry_get_merge_conflict_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_with_merge_conflict_count(geom, &count));
CHK(count == 0);
- OK(sg3_geometry_get_triangle_with_undefined_interface_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_with_unspecified_interface_count(geom, &count));
CHK(count == 0);
- OK(sg3_geometry_get_triangle_with_undefined_side_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_with_unspecified_side_count(geom, &count));
CHK(count == 0);
- OK(sg3_geometry_dump_as_C_code(geom, stdout, "some_enclosures",
- SG3_CDUMP_CONST | SG3_CDUMP_STATIC));
+ OK(sg3_geometry_dump_as_c_code(geom, stdout, "some_enclosures",
+ SG3_C_DUMP_CONST | SG3_C_DUMP_STATIC));
SG3(geometry_ref_put(geom));
diff --git a/src/test_sg3_some_triangles.c b/src/test_sg3_some_triangles.c
@@ -69,15 +69,15 @@ main(int argc, char** argv)
}
S3DUT(mesh_ref_put(cyl));
- OK(sg3_geometry_get_merge_conflict_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_with_merge_conflict_count(geom, &count));
CHK(count == 0);
- OK(sg3_geometry_get_triangle_with_undefined_interface_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_with_unspecified_interface_count(geom, &count));
CHK(count == 0);
- OK(sg3_geometry_get_triangle_with_undefined_side_count(geom, &count));
+ OK(sg3_geometry_get_unique_primitives_with_unspecified_side_count(geom, &count));
CHK(count == 0);
- OK(sg3_geometry_dump_as_C_code(geom, stdout, "some_triangles",
- SG3_CDUMP_CONST | SG3_CDUMP_STATIC));
+ OK(sg3_geometry_dump_as_c_code(geom, stdout, "some_triangles",
+ SG3_C_DUMP_CONST | SG3_C_DUMP_STATIC));
SG3(geometry_ref_put(geom));
diff --git a/src/test_sg3_undefined_properties.c b/src/test_sg3_undefined_properties.c
@@ -1,143 +0,0 @@
-/* Copyright (C) 2019-2020 |Meso|Star> (contact@meso-star.com)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#include "sg3.h"
-#include "test_sg3_utils.h"
-
-#include <stdio.h>
-
-int
-main(int argc, char** argv)
-{
- struct mem_allocator allocator;
- struct sg3_device* dev;
- struct sg3_geometry* geom;
- struct context ctx = CONTEXT_NULL__;
- struct sg3_geometry_add_callbacks callbacks = SG3_ADD_CALLBACKS_NULL__;
- unsigned property[12];
- unsigned i;
- const unsigned property_count = sizeof(property) / sizeof(*property);
- unsigned count;
- (void)argc, (void)argv;
-
- OK(mem_init_proxy_allocator(&allocator, &mem_default_allocator));
- OK(sg3_device_create(NULL, &allocator, 1, &dev));
- OK(sg3_geometry_create(dev, &geom));
-
- FOR_EACH(i, 0, property_count) property[i] = SG3_UNDEFINED_PROPERTY;
-
- callbacks.get_indices = get_indices;
- callbacks.get_position = get_position;
-
- /* A 3D cube.
- * 2 enclosures (inside, outside) sharing the same triangles,
- * but opposite sides */
- ctx.positions = box_vertices;
- ctx.indices = cube_indices;
-
- /* Add geometry with no properties */
- ctx.front_media = property;
- ctx.back_media = medium1;
- ctx.intface = property;
- OK(sg3_geometry_add(geom, ntriangles, nvertices, &callbacks, &ctx));
- OK(sg3_geometry_get_triangle_with_undefined_side_count(geom, &count));
- CHK(count == ntriangles);
- OK(sg3_geometry_get_added_triangles_count(geom, &count));
- CHK(count == ntriangles);
-
- /* Add same geometry with no properties on front/intface */
- callbacks.get_properties = get_properties;
- OK(sg3_geometry_add(geom, ntriangles, nvertices, &callbacks, &ctx));
- OK(sg3_geometry_get_triangle_with_undefined_side_count(geom, &count));
- CHK(count == ntriangles);
- OK(sg3_geometry_get_added_triangles_count(geom, &count));
- CHK(count == 2 * ntriangles);
-
- OK(sg3_geometry_dump_as_C_code(geom, stdout, "front_undefined",
- SG3_CDUMP_STATIC | SG3_CDUMP_CONST));
-
- /* Add same geometry, front/intface properties are defined for odd triangles */
- FOR_EACH(i, 0, sizeof(property) / sizeof(*property))
- property[i] = (i % 2) ? 0 : SG3_UNDEFINED_PROPERTY;
- OK(sg3_geometry_add(geom, ntriangles, nvertices, &callbacks, &ctx));
- OK(sg3_geometry_get_triangle_with_undefined_side_count(geom, &count));
- CHK(count == ntriangles / 2);
- OK(sg3_geometry_get_unique_vertices_count(geom, &count));
- CHK(count == nvertices);
- OK(sg3_geometry_get_added_triangles_count(geom, &count));
- CHK(count == 3 * ntriangles);
- OK(sg3_geometry_get_unique_triangles_count(geom, &count));
- CHK(count == ntriangles);
- FOR_EACH(i, 0, count) {
- unsigned prop[SG3_PROP_TYPES_COUNT__];
- OK(sg3_geometry_get_unique_triangle_properties(geom, i, prop));
- CHK(prop[SG3_FRONT] == ((i % 2) ? 0 : SG3_UNDEFINED_PROPERTY)
- && prop[SG3_BACK] == 1
- && prop[SG3_INTFACE] == ((i % 2) ? 0 : SG3_UNDEFINED_PROPERTY));
- }
-
- /* Same information again, using a reversed box */
- ctx.reverse_vrtx = 1;
- SWAP(const unsigned*, ctx.front_media, ctx.back_media);
- OK(sg3_geometry_add(geom, ntriangles, nvertices, &callbacks, &ctx));
- OK(sg3_geometry_get_triangle_with_undefined_side_count(geom, &count));
- CHK(count == ntriangles / 2);
- OK(sg3_geometry_get_added_triangles_count(geom, &count));
- CHK(count == 4 * ntriangles);
-
- OK(sg3_geometry_dump_as_C_code(geom, stdout, "front_half_undefined",
- SG3_CDUMP_STATIC | SG3_CDUMP_CONST));
-
- /* Define properties for remaining triangles, using reversed box */
- FOR_EACH(i, 0, sizeof(property) / sizeof(*property))
- property[i] = (i % 2) ? SG3_UNDEFINED_PROPERTY : 0;
- OK(sg3_geometry_add(geom, ntriangles, nvertices, &callbacks, &ctx));
- OK(sg3_geometry_get_triangle_with_undefined_side_count(geom, &count));
- CHK(count == 0);
- OK(sg3_geometry_get_unique_vertices_count(geom, &count));
- CHK(count == nvertices);
- OK(sg3_geometry_get_added_triangles_count(geom, &count));
- CHK(count == 5 * ntriangles);
- OK(sg3_geometry_get_unique_triangles_count(geom, &count));
- CHK(count == ntriangles);
- FOR_EACH(i, 0, count) {
- unsigned prop[3];
- OK(sg3_geometry_get_unique_triangle_properties(geom, i, prop));
- CHK(prop[SG3_FRONT] == 0 && prop[SG3_BACK] == 1
- && prop[SG3_INTFACE] == 0);
- }
-
- OK(sg3_geometry_dump_as_C_code(geom, stdout, "all_defined",
- SG3_CDUMP_STATIC | SG3_CDUMP_CONST));
-
- /* Define incoherent properties for some triangles */
- FOR_EACH(i, 0, sizeof(property) / sizeof(*property))
- property[i] = (i % 2);
- OK(sg3_geometry_add(geom, ntriangles, nvertices, &callbacks, &ctx));
- OK(sg3_geometry_get_merge_conflict_count(geom, &count));
- CHK(count == ntriangles / 2);
- OK(sg3_geometry_get_properties_conflict_count(geom, &count));
- CHK(count == 0);
- OK(sg3_geometry_get_added_triangles_count(geom, &count));
- CHK(count == 6 * ntriangles);
-
- OK(sg3_geometry_ref_put(geom));
- OK(sg3_device_ref_put(dev));
-
- check_memory_allocator(&allocator);
- mem_shutdown_proxy_allocator(&allocator);
- CHK(mem_allocated_size() == 0);
- return 0;
-}
diff --git a/src/test_sg3_unspecified_properties.c b/src/test_sg3_unspecified_properties.c
@@ -0,0 +1,143 @@
+/* Copyright (C) 2019-2020 |Meso|Star> (contact@meso-star.com)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include "sg3.h"
+#include "test_sg3_utils.h"
+
+#include <stdio.h>
+
+int
+main(int argc, char** argv)
+{
+ struct mem_allocator allocator;
+ struct sg3_device* dev;
+ struct sg3_geometry* geom;
+ struct context ctx = CONTEXT_NULL__;
+ struct sg3_geometry_add_callbacks callbacks = SG3_ADD_CALLBACKS_NULL__;
+ unsigned property[12];
+ unsigned i;
+ const unsigned property_count = sizeof(property) / sizeof(*property);
+ unsigned count;
+ (void)argc, (void)argv;
+
+ OK(mem_init_proxy_allocator(&allocator, &mem_default_allocator));
+ OK(sg3_device_create(NULL, &allocator, 1, &dev));
+ OK(sg3_geometry_create(dev, &geom));
+
+ FOR_EACH(i, 0, property_count) property[i] = SG3_UNSPECIFIED_PROPERTY;
+
+ callbacks.get_indices = get_indices;
+ callbacks.get_position = get_position;
+
+ /* A 3D cube.
+ * 2 enclosures (inside, outside) sharing the same triangles,
+ * but opposite sides */
+ ctx.positions = box_vertices;
+ ctx.indices = cube_indices;
+
+ /* Add geometry with no properties */
+ ctx.front_media = property;
+ ctx.back_media = medium1;
+ ctx.intface = property;
+ OK(sg3_geometry_add(geom, ntriangles, nvertices, &callbacks, &ctx));
+ OK(sg3_geometry_get_unique_primitives_with_unspecified_side_count(geom, &count));
+ CHK(count == ntriangles);
+ OK(sg3_geometry_get_added_primitives_count(geom, &count));
+ CHK(count == ntriangles);
+
+ /* Add same geometry with no properties on front/intface */
+ callbacks.get_properties = get_properties;
+ OK(sg3_geometry_add(geom, ntriangles, nvertices, &callbacks, &ctx));
+ OK(sg3_geometry_get_unique_primitives_with_unspecified_side_count(geom, &count));
+ CHK(count == ntriangles);
+ OK(sg3_geometry_get_added_primitives_count(geom, &count));
+ CHK(count == 2 * ntriangles);
+
+ OK(sg3_geometry_dump_as_c_code(geom, stdout, "front_unspecified",
+ SG3_C_DUMP_STATIC | SG3_C_DUMP_CONST));
+
+ /* Add same geometry, front/intface properties are defined for odd triangles */
+ FOR_EACH(i, 0, sizeof(property) / sizeof(*property))
+ property[i] = (i % 2) ? 0 : SG3_UNSPECIFIED_PROPERTY;
+ OK(sg3_geometry_add(geom, ntriangles, nvertices, &callbacks, &ctx));
+ OK(sg3_geometry_get_unique_primitives_with_unspecified_side_count(geom, &count));
+ CHK(count == ntriangles / 2);
+ OK(sg3_geometry_get_unique_vertices_count(geom, &count));
+ CHK(count == nvertices);
+ OK(sg3_geometry_get_added_primitives_count(geom, &count));
+ CHK(count == 3 * ntriangles);
+ OK(sg3_geometry_get_unique_primitives_count(geom, &count));
+ CHK(count == ntriangles);
+ FOR_EACH(i, 0, count) {
+ unsigned prop[SG3_PROP_TYPES_COUNT__];
+ OK(sg3_geometry_get_unique_primitive_properties(geom, i, prop));
+ CHK(prop[SG3_FRONT] == ((i % 2) ? 0 : SG3_UNSPECIFIED_PROPERTY)
+ && prop[SG3_BACK] == 1
+ && prop[SG3_INTFACE] == ((i % 2) ? 0 : SG3_UNSPECIFIED_PROPERTY));
+ }
+
+ /* Same information again, using a reversed box */
+ ctx.reverse_vrtx = 1;
+ SWAP(const unsigned*, ctx.front_media, ctx.back_media);
+ OK(sg3_geometry_add(geom, ntriangles, nvertices, &callbacks, &ctx));
+ OK(sg3_geometry_get_unique_primitives_with_unspecified_side_count(geom, &count));
+ CHK(count == ntriangles / 2);
+ OK(sg3_geometry_get_added_primitives_count(geom, &count));
+ CHK(count == 4 * ntriangles);
+
+ OK(sg3_geometry_dump_as_c_code(geom, stdout, "front_half_unspecified",
+ SG3_C_DUMP_STATIC | SG3_C_DUMP_CONST));
+
+ /* Define properties for remaining triangles, using reversed box */
+ FOR_EACH(i, 0, sizeof(property) / sizeof(*property))
+ property[i] = (i % 2) ? SG3_UNSPECIFIED_PROPERTY : 0;
+ OK(sg3_geometry_add(geom, ntriangles, nvertices, &callbacks, &ctx));
+ OK(sg3_geometry_get_unique_primitives_with_unspecified_side_count(geom, &count));
+ CHK(count == 0);
+ OK(sg3_geometry_get_unique_vertices_count(geom, &count));
+ CHK(count == nvertices);
+ OK(sg3_geometry_get_added_primitives_count(geom, &count));
+ CHK(count == 5 * ntriangles);
+ OK(sg3_geometry_get_unique_primitives_count(geom, &count));
+ CHK(count == ntriangles);
+ FOR_EACH(i, 0, count) {
+ unsigned prop[3];
+ OK(sg3_geometry_get_unique_primitive_properties(geom, i, prop));
+ CHK(prop[SG3_FRONT] == 0 && prop[SG3_BACK] == 1
+ && prop[SG3_INTFACE] == 0);
+ }
+
+ OK(sg3_geometry_dump_as_c_code(geom, stdout, "all_defined",
+ SG3_C_DUMP_STATIC | SG3_C_DUMP_CONST));
+
+ /* Define incoherent properties for some triangles */
+ FOR_EACH(i, 0, sizeof(property) / sizeof(*property))
+ property[i] = (i % 2);
+ OK(sg3_geometry_add(geom, ntriangles, nvertices, &callbacks, &ctx));
+ OK(sg3_geometry_get_unique_primitives_with_merge_conflict_count(geom, &count));
+ CHK(count == ntriangles / 2);
+ OK(sg3_geometry_get_unique_primitives_with_properties_conflict_count(geom, &count));
+ CHK(count == 0);
+ OK(sg3_geometry_get_added_primitives_count(geom, &count));
+ CHK(count == 6 * ntriangles);
+
+ OK(sg3_geometry_ref_put(geom));
+ OK(sg3_device_ref_put(dev));
+
+ check_memory_allocator(&allocator);
+ mem_shutdown_proxy_allocator(&allocator);
+ CHK(mem_allocated_size() == 0);
+ return 0;
+}