commit 84ae5b9325220b287461efbca58717aeeae002dc
parent 2f2e8d89d1f538ea18d75ca43cfc6a966b43e14b
Author: Christophe Coustet <christophe.coustet@meso-star.com>
Date: Mon, 27 Jan 2020 18:17:59 +0100
API rename
Diffstat:
17 files changed, 450 insertions(+), 448 deletions(-)
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
@@ -142,14 +142,14 @@ if(NOT NO_TEST)
new_test(test_sg2_square_on_square)
new_test(test_sg2_some_enclosures test_sg2_utils2.h)
new_test(test_sg2_some_segments test_sg2_utils2.h)
- new_test(test_sg2_undefined_properties)
+ new_test(test_sg2_unspecified_properties)
rcmake_copy_runtime_libraries(test_sg2_square_behind_square)
rcmake_copy_runtime_libraries(test_sg2_square_in_square)
rcmake_copy_runtime_libraries(test_sg2_square_on_square)
rcmake_copy_runtime_libraries(test_sg2_some_enclosures)
rcmake_copy_runtime_libraries(test_sg2_some_segments)
- rcmake_copy_runtime_libraries(test_sg2_undefined_properties)
+ rcmake_copy_runtime_libraries(test_sg2_unspecified_properties)
endif()
if(HUGE_ADDITIONAL_TESTS)
diff --git a/src/sg2.h b/src/sg2.h
@@ -66,29 +66,31 @@ enum sg2_property_type {
/*******************************************************************************
* A type to list the different possible partitions of segments.
******************************************************************************/
-enum sg2_dump_content {
- SG2_MERGE_CONFLICTS = BIT(0),
- SG2_PROPERTY_CONFLICTS = BIT(1),
- SG2_VALID_SEGMENT = BIT(2),
- SG2_ALL_SEGMENTS =
- SG2_MERGE_CONFLICTS | SG2_PROPERTY_CONFLICTS | SG2_VALID_SEGMENT
+enum sg2_obj_dump_content {
+ SG2_OBJ_DUMP_MERGE_CONFLICTS = BIT(0),
+ SG2_OBJ_DUMP_PROPERTY_CONFLICTS = BIT(1),
+ SG2_OBJ_DUMP_VALID_PRIMITIVE = BIT(2),
+ SG2_OBJ_DUMP_ALL =
+ SG2_OBJ_DUMP_MERGE_CONFLICTS
+ | SG2_OBJ_DUMP_PROPERTY_CONFLICTS
+ | SG2_OBJ_DUMP_VALID_PRIMITIVE
};
/*******************************************************************************
* A type to list the different qualifiers of C code variable output.
******************************************************************************/
enum sg2_cdump_qualifiers {
- SG2_CDUMP_CONST = BIT(0),
- SG2_CDUMP_STATIC = BIT(1)
+ SG2_C_DUMP_CONST = BIT(0),
+ SG2_C_DUMP_STATIC = BIT(1)
};
/*******************************************************************************
* The value that should be used for properties attached to segments (i.e.
* media or interface) when not defined.
- * SG2_UNDEFINED_PROPERTY can be used for a property that has already been
+ * SG2_UNSPECIFIED_PROPERTY can be used for a property that has already been
* defined; in this case the previous value will remain.
******************************************************************************/
-#define SG2_UNDEFINED_PROPERTY UINT_MAX
+#define SG2_UNSPECIFIED_PROPERTY UINT_MAX
/*******************************************************************************
* A type to hold callbacks for sg2_geometry_add.
@@ -98,7 +100,7 @@ struct sg2_geometry_add_callbacks {
void(*get_indices)
(const unsigned iseg, unsigned ids[2], void* context);
/* User function that provides properties for added segments */
- void(*get_properties) /* Can be NULL <=> SG2_UNDEFINED_PROPERTY used */
+ void(*get_properties) /* Can be NULL <=> SG2_UNSPECIFIED_PROPERTY used */
(const unsigned iseg,
/* 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 @@ sg2_compatible_property
(const unsigned p1,
const unsigned p2)
{
- if(p1 == SG2_UNDEFINED_PROPERTY || p2 == SG2_UNDEFINED_PROPERTY) return 1;
+ if(p1 == SG2_UNSPECIFIED_PROPERTY || p2 == SG2_UNSPECIFIED_PROPERTY) return 1;
return (p1 == p2);
}
@@ -197,7 +199,7 @@ sg2_geometry_reserve
/* Add a new set of 3D vertices and segments to the geometry; segments can
* be decorated with 3 properties (front and back media and interface) that can
- * be let undefined using the SG2_UNDEFINED_PROPERTY special value.
+ * be let unspecified using the SG2_UNSPECIFIED_PROPERTY special value.
* Vertices can be duplicates and are silently deduplicated, always valid.
* Segments can be duplicates, but this can be ruled invalid due to property
* inconsistency. Segment duplicates are silently deduplicated, even if
@@ -214,14 +216,14 @@ sg2_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
- * segment before the SG2_UNDEFINED_PROPERTY overwriting step;
- * - if not, a non-SG2_UNDEFINED_PROPERTY is only consistent with itself and
- * with SG2_UNDEFINED_PROPERTY (if inconsistent, merge_conflict_status is set
+ * segment before the SG2_UNSPECIFIED_PROPERTY overwriting step;
+ * - if not, a non-SG2_UNSPECIFIED_PROPERTY is only consistent with itself and
+ * with SG2_UNSPECIFIED_PROPERTY (if inconsistent, merge_conflict_status is set
* to 1 and recorded) ; regardless of merge_conflict_status, a
- * non-SG2_UNDEFINED_PROPERTY property is never overridden.
+ * non-SG2_UNSPECIFIED_PROPERTY property is never overridden.
* When deduplicating segments, the first occurence remains (with its
* original index in user world). After consistency being computed, a final
- * step consists in rewriting SG2_UNDEFINED_PROPERTY properties if the merged
+ * step consists in rewriting SG2_UNSPECIFIED_PROPERTY properties if the merged
* property is defined. */
SG2_API res_T
sg2_geometry_add
@@ -265,26 +267,26 @@ sg2_geometry_get_unique_vertex
/* Get the number of segments added to the geometry, regardless of unicity. */
SG2_API res_T
-sg2_geometry_get_added_segments_count
+sg2_geometry_get_added_primitives_count
(const struct sg2_geometry* geometry,
unsigned* count);
/* Get the number of unique segments. */
SG2_API res_T
-sg2_geometry_get_unique_segments_count
+sg2_geometry_get_unique_primitives_count
(const struct sg2_geometry* geometry,
unsigned* count);
/* Get the vertex indices of the iseg_th unique segment. */
SG2_API res_T
-sg2_geometry_get_unique_segment_vertices
+sg2_geometry_get_unique_primitive_vertices
(const struct sg2_geometry* geometry,
const unsigned iseg,
unsigned indices[2]);
/* Get the properties of the iseg_th unique segment. */
SG2_API res_T
-sg2_geometry_get_unique_segment_properties
+sg2_geometry_get_unique_primitive_properties
(const struct sg2_geometry* geometry,
const unsigned iseg,
unsigned properties[SG2_PROP_TYPES_COUNT__]);
@@ -295,33 +297,33 @@ sg2_geometry_get_unique_segment_properties
* submitted to sg2_geometry_add calls, regardless of duplication or
* sg2_geometry_add failures (non-RES_OK return value). */
SG2_API res_T
-sg2_geometry_get_unique_segment_user_id
+sg2_geometry_get_unique_primitive_user_id
(const struct sg2_geometry* geometry,
const unsigned iseg,
unsigned* user_id);
-/* Get the number of segment with (at least) one undefined side. */
+/* Get the number of segments with (at least) one unspecified side. */
SG2_API res_T
-sg2_geometry_get_segment_with_undefined_side_count
+sg2_geometry_get_unique_primitives_with_unspecified_side_count
(const struct sg2_geometry* geometry,
unsigned* count);
-/* Get the number of segment with undefined interface. */
+/* Get the number of segments with unspecified interface. */
SG2_API res_T
-sg2_geometry_get_segment_with_undefined_interface_count
+sg2_geometry_get_unique_primitives_with_unspecified_interface_count
(const struct sg2_geometry* geometry,
unsigned* count);
-/* Get the number of segment flagged with a merge conflict. */
+/* Get the number of segments flagged with a merge conflict. */
SG2_API res_T
-sg2_geometry_get_merge_conflict_count
+sg2_geometry_get_unique_primitives_with_merge_conflict_count
(const struct sg2_geometry* geometry,
unsigned* count);
-/* Get the number of segment flagged with a property conflict. Only meaningful
+/* Get the number of segments flagged with a property conflict. Only meaningful
* after sg2_geometry_validate_properties has been called. */
SG2_API res_T
-sg2_geometry_get_properties_conflict_count
+sg2_geometry_get_unique_primitives_with_properties_conflict_count
(const struct sg2_geometry* geometry,
unsigned* count);
@@ -330,7 +332,7 @@ sg2_geometry_get_properties_conflict_count
* in this output are 3D with Z==0, as OBJ files cannot define 2 vertices.
* The dump is made of the vertices and some segments, without their
* properties. The dumped segments are defined by the flags argument, that
- * must be ORed enum sg2_dump_content values.
+ * must be ORed enum sg2_obj_dump_content values.
* The dumped segments are partitioned in the following groups:
* - Valid_segments
* - Merge_conflicts
@@ -346,11 +348,11 @@ sg2_geometry_dump_as_obj
* in this output are 3D with Z==0, as VTK text files cannot define 2 POINTS.
* The dump is made of the vertices and segments, 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_sg2_geometry_add (rank of the sg2_geometry_add that created the
@@ -372,7 +374,7 @@ sg2_geometry_dump_as_vtk
* The two qualifiers static and const are output or not according to flags;
* flags must be ORed enum sg2_cdump_qualifiers values. */
SG2_API res_T
-sg2_geometry_dump_as_C_code
+sg2_geometry_dump_as_c_code
(const struct sg2_geometry* geometry,
FILE* stream,
const char* name_prefix, /* Can be NULL or "" */
diff --git a/src/sg2_geometry.c b/src/sg2_geometry.c
@@ -70,7 +70,7 @@ dump_seg_property
descriptions
= darray_seg_descriptions_cdata_get(&geom->seg_descriptions);
FOR_EACH(i, 0, darray_segment_size_get(&geom->unique_segments)) {
- unsigned property = SG2_UNDEFINED_PROPERTY;
+ unsigned property = SG2_UNSPECIFIED_PROPERTY;
size_t tdefs_count
= darray_definition_size_get(&descriptions[i].defs[type]);
if(tdefs_count && descriptions[i].property_defined[type]) {
@@ -78,14 +78,14 @@ dump_seg_property
= darray_definition_cdata_get(&descriptions[i].defs[type]);
size_t j;
FOR_EACH(j, 0, tdefs_count) {
- if(tdefs->property_value != SG2_UNDEFINED_PROPERTY) {
+ if(tdefs->property_value != SG2_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));
}
}
@@ -118,8 +118,8 @@ geometry_register_segment
int done = 0;
size_t j;
keep_prop_def[i] = seg_d->property_defined[i];
- if(segment->properties[i] == SG2_UNDEFINED_PROPERTY)
- seg_d->defs_include_undefined = 1;
+ if(segment->properties[i] == SG2_UNSPECIFIED_PROPERTY)
+ seg_d->defs_include_unspecified = 1;
else seg_d->property_defined[i] = 1;
definitions = seg_d->defs + i;
defs = darray_definition_data_get(definitions);
@@ -164,14 +164,14 @@ geometry_register_segment
&& seg_d->property_defined[SG2_FRONT] && seg_d->property_defined[SG2_BACK])
{
/* Both sides are now defined */
- ASSERT(geom->seg_with_undef_sides_count > 0);
- geom->seg_with_undef_sides_count--;
+ ASSERT(geom->seg_with_unspecified_sides_count > 0);
+ geom->seg_with_unspecified_sides_count--;
}
if(!keep_prop_def[SG2_INTFACE] && seg_d->property_defined[SG2_INTFACE]) {
/* Interface is now defined */
- ASSERT(geom->seg_with_undef_intface_count > 0);
- geom->seg_with_undef_intface_count--;
+ ASSERT(geom->seg_with_unspecified_intface_count > 0);
+ geom->seg_with_unspecified_intface_count--;
}
exit:
@@ -191,8 +191,8 @@ geometry_enlarge_seg_descriptions
if(sz <= old_sz) return RES_OK;
ASSERT(sz - old_sz < UINT_MAX);
ERR(darray_seg_descriptions_resize(&geom->seg_descriptions, sz));
- geom->seg_with_undef_sides_count += (unsigned)(sz - old_sz);
- geom->seg_with_undef_intface_count += (unsigned)(sz - old_sz);
+ geom->seg_with_unspecified_sides_count += (unsigned)(sz - old_sz);
+ geom->seg_with_unspecified_intface_count += (unsigned)(sz - old_sz);
exit:
return res;
@@ -205,15 +205,15 @@ dump_partition
(const struct sg2_geometry* geom,
FILE* stream,
const char* group_name,
- enum sg2_dump_content partition)
+ enum sg2_obj_dump_content partition)
{
const struct seg_descriptions* seg_descriptions;
const struct segment* segments;
size_t sz, i;
ASSERT(geom && stream && group_name);
- ASSERT(partition == SG2_MERGE_CONFLICTS
- || partition == SG2_PROPERTY_CONFLICTS
- || partition == SG2_VALID_SEGMENT);
+ ASSERT(partition == SG2_OBJ_DUMP_MERGE_CONFLICTS
+ || partition == SG2_OBJ_DUMP_PROPERTY_CONFLICTS
+ || partition == SG2_OBJ_DUMP_VALID_PRIMITIVE);
seg_descriptions
= darray_seg_descriptions_cdata_get(&geom->seg_descriptions);
sz = darray_seg_descriptions_size_get(&geom->seg_descriptions);
@@ -221,13 +221,13 @@ dump_partition
fprintf(stream, "g %s\n", group_name);
FOR_EACH(i, 0, sz) {
int dump;
- if(partition == SG2_VALID_SEGMENT)
+ if(partition == SG2_OBJ_DUMP_VALID_PRIMITIVE)
dump = !(seg_descriptions[i].merge_conflict
|| seg_descriptions[i].properties_conflict);
- else if(partition == SG2_MERGE_CONFLICTS)
+ else if(partition == SG2_OBJ_DUMP_MERGE_CONFLICTS)
dump = seg_descriptions[i].merge_conflict;
else {
- ASSERT(partition == SG2_PROPERTY_CONFLICTS);
+ ASSERT(partition == SG2_OBJ_DUMP_PROPERTY_CONFLICTS);
dump = seg_descriptions[i].properties_conflict;
}
if(!dump) continue;
@@ -271,8 +271,8 @@ sg2_geometry_create
geom->segment_count_including_duplicates = 0;
geom->sides_with_defined_medium_count = 0;
geom->set_id = 0;
- geom->seg_with_undef_sides_count = 0;
- geom->seg_with_undef_intface_count = 0;
+ geom->seg_with_unspecified_sides_count = 0;
+ geom->seg_with_unspecified_intface_count = 0;
geom->merge_conflict_count = 0;
geom->properties_conflict_count = 0;
geom->dev = dev;
@@ -444,10 +444,10 @@ sg2_geometry_add
}
if(seg_descriptions[i].merge_conflict && !already_conflict)
geom->merge_conflict_count++;
- /* Replace SG2_UNDEFINED_PROPERTY properties */
+ /* Replace SG2_UNSPECIFIED_PROPERTY properties */
FOR_EACH(j, 0, SG2_PROP_TYPES_COUNT__) {
- if(seg[*p_seg].properties[j] == SG2_UNDEFINED_PROPERTY
- && tmp.properties[j] != SG2_UNDEFINED_PROPERTY) {
+ if(seg[*p_seg].properties[j] == SG2_UNSPECIFIED_PROPERTY
+ && tmp.properties[j] != SG2_UNSPECIFIED_PROPERTY) {
seg[*p_seg].properties[j] = tmp.properties[j];
if(j == SG2_FRONT || j == SG2_BACK)
geom->sides_with_defined_medium_count++;
@@ -466,7 +466,7 @@ sg2_geometry_add
ERR(darray_segment_push_back(&geom->unique_segments, &tmp));
FOR_EACH(j, 0, SG2_PROP_TYPES_COUNT__) {
if((j == SG2_FRONT || j == SG2_BACK)
- && tmp.properties[j] != SG2_UNDEFINED_PROPERTY)
+ && tmp.properties[j] != SG2_UNSPECIFIED_PROPERTY)
geom->sides_with_defined_medium_count++;
}
ASSERT(unique_id == htable_seg_size_get(&geom->unique_segments_ids));
@@ -529,9 +529,9 @@ sg2_geometry_validate_properties
/* Get properties for non-conflict segments */
FOR_EACH(p, 0, SG2_PROP_TYPES_COUNT__) {
const struct definition* defs = darray_definition_cdata_get(segd->defs + p);
- props[p] = SG2_UNDEFINED_PROPERTY;
+ props[p] = SG2_UNSPECIFIED_PROPERTY;
FOR_EACH(j, 0, darray_definition_size_get(segd->defs + p)) {
- if(defs[j].property_value != SG2_UNDEFINED_PROPERTY) {
+ if(defs[j].property_value != SG2_UNSPECIFIED_PROPERTY) {
props[p] = defs[j].property_value;
break;
}
@@ -592,7 +592,7 @@ error:
}
res_T
-sg2_geometry_get_added_segments_count
+sg2_geometry_get_added_primitives_count
(const struct sg2_geometry* geom,
unsigned* count)
{
@@ -609,7 +609,7 @@ error:
}
res_T
-sg2_geometry_get_unique_segments_count
+sg2_geometry_get_unique_primitives_count
(const struct sg2_geometry* geom,
unsigned* count)
{
@@ -629,7 +629,7 @@ error:
}
res_T
-sg2_geometry_get_unique_segment_vertices
+sg2_geometry_get_unique_primitive_vertices
(const struct sg2_geometry* geom,
const unsigned iseg,
unsigned indices[2])
@@ -652,7 +652,7 @@ error:
}
res_T
-sg2_geometry_get_unique_segment_properties
+sg2_geometry_get_unique_primitive_properties
(const struct sg2_geometry* geom,
const unsigned iseg,
unsigned properties[SG2_PROP_TYPES_COUNT__])
@@ -676,7 +676,7 @@ error:
}
res_T
-sg2_geometry_get_unique_segment_user_id
+sg2_geometry_get_unique_primitive_user_id
(const struct sg2_geometry* geom,
const unsigned iseg,
unsigned* user_id)
@@ -698,7 +698,7 @@ error:
}
res_T
-sg2_geometry_get_segment_with_undefined_side_count
+sg2_geometry_get_unique_primitives_with_unspecified_side_count
(const struct sg2_geometry* geom,
unsigned* count)
{
@@ -707,7 +707,7 @@ sg2_geometry_get_segment_with_undefined_side_count
res = RES_BAD_ARG;
goto error;
}
- *count = geom->seg_with_undef_sides_count;
+ *count = geom->seg_with_unspecified_sides_count;
exit:
return res;
error:
@@ -715,7 +715,7 @@ error:
}
res_T
-sg2_geometry_get_segment_with_undefined_interface_count
+sg2_geometry_get_unique_primitives_with_unspecified_interface_count
(const struct sg2_geometry* geom,
unsigned* count)
{
@@ -724,7 +724,7 @@ sg2_geometry_get_segment_with_undefined_interface_count
res = RES_BAD_ARG;
goto error;
}
- *count = geom->seg_with_undef_intface_count;
+ *count = geom->seg_with_unspecified_intface_count;
exit:
return res;
error:
@@ -732,7 +732,7 @@ error:
}
res_T
-sg2_geometry_get_merge_conflict_count
+sg2_geometry_get_unique_primitives_with_merge_conflict_count
(const struct sg2_geometry* geom,
unsigned* count)
{
@@ -749,7 +749,7 @@ error:
}
res_T
-sg2_geometry_get_properties_conflict_count
+sg2_geometry_get_unique_primitives_with_properties_conflict_count
(const struct sg2_geometry* geom,
unsigned* count)
{
@@ -806,9 +806,9 @@ sg2_geometry_dump_as_obj
fprintf(stream, "v %g %g 0\n", SPLIT2(vertices[i].coord));
/* Dump segments by groups */
- dump_partition(geom, stream, "Valid_segments", SG2_VALID_SEGMENT);
- dump_partition(geom, stream, "Merge_conflicts", SG2_MERGE_CONFLICTS);
- dump_partition(geom, stream, "Property_conflicts", SG2_PROPERTY_CONFLICTS);
+ dump_partition(geom, stream, "Valid_segments", SG2_OBJ_DUMP_VALID_PRIMITIVE);
+ dump_partition(geom, stream, "Merge_conflicts", SG2_OBJ_DUMP_MERGE_CONFLICTS);
+ dump_partition(geom, stream, "Property_conflicts", SG2_OBJ_DUMP_PROPERTY_CONFLICTS);
exit:
return res;
@@ -913,7 +913,7 @@ error:
}
res_T
-sg2_geometry_dump_as_C_code
+sg2_geometry_dump_as_c_code
(const struct sg2_geometry* geom,
FILE* stream,
const char* name_prefix,
@@ -961,11 +961,11 @@ sg2_geometry_dump_as_C_code
goto error;
}
- if(flags & SG2_CDUMP_CONST && flags & SG2_CDUMP_STATIC)
+ if(flags & SG2_C_DUMP_CONST && flags & SG2_C_DUMP_STATIC)
qualifiers = "static const ";
- else if(flags & SG2_CDUMP_CONST)
+ else if(flags & SG2_C_DUMP_CONST)
qualifiers = "const ";
- else if(flags & SG2_CDUMP_STATIC)
+ else if(flags & SG2_C_DUMP_STATIC)
qualifiers = "static ";
else qualifiers = "";
@@ -1012,8 +1012,8 @@ sg2_geometry_dump_as_C_code
int p;
fprintf(stream, " ");
FOR_EACH(p, 0, SG2_PROP_TYPES_COUNT__) {
- if(segments[i].properties[p] == SG2_UNDEFINED_PROPERTY)
- fprintf(stream, " SG2_UNDEFINED_PROPERTY");
+ if(segments[i].properties[p] == SG2_UNSPECIFIED_PROPERTY)
+ fprintf(stream, " SG2_UNSPECIFIED_PROPERTY");
else fprintf(stream," %u", segments[i].properties[p]);
if(i < tsz-1 || p < 2) fprintf(stream, ",");
if(p == 2) fprintf(stream, "\n");
diff --git a/src/sg2_geometry.h b/src/sg2_geometry.h
@@ -36,9 +36,9 @@ struct segment {
unsigned user_id;
};
#define SEG_UNDEF__ {\
- { SG2_UNDEFINED_PROPERTY, SG2_UNDEFINED_PROPERTY },\
- { SG2_UNDEFINED_PROPERTY, SG2_UNDEFINED_PROPERTY, SG2_UNDEFINED_PROPERTY },\
- SG2_UNDEFINED_PROPERTY\
+ { SG2_UNSPECIFIED_PROPERTY, SG2_UNSPECIFIED_PROPERTY },\
+ { SG2_UNSPECIFIED_PROPERTY, SG2_UNSPECIFIED_PROPERTY, SG2_UNSPECIFIED_PROPERTY },\
+ SG2_UNSPECIFIED_PROPERTY\
}
#define DARRAY_NAME segment
#define DARRAY_DATA struct segment
@@ -109,7 +109,7 @@ init_definition
struct definition* data)
{
ASSERT(alloc && data);
- data->property_value = SG2_UNDEFINED_PROPERTY;
+ data->property_value = SG2_UNSPECIFIED_PROPERTY;
darray_uint_init(alloc, &data->set_ids);
}
@@ -149,7 +149,7 @@ struct seg_descriptions {
struct darray_definition defs[SG2_PROP_TYPES_COUNT__];
int merge_conflict;
int properties_conflict;
- char defs_include_undefined;
+ char defs_include_unspecified;
char property_defined[SG2_PROP_TYPES_COUNT__];
};
@@ -164,7 +164,7 @@ init_seg_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, SG2_PROP_TYPES_COUNT__)
data->property_defined[i] = 0;
}
@@ -181,7 +181,7 @@ copy_seg_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, SG2_PROP_TYPES_COUNT__)
dst->property_defined[i] = src->property_defined[i];
exit:
@@ -216,7 +216,7 @@ init_seg_intfaceid
unsigned* data)
{
ASSERT(data); (void)alloc;
- *data = SG2_UNDEFINED_PROPERTY;
+ *data = SG2_UNSPECIFIED_PROPERTY;
}
#define DARRAY_NAME intface_id
@@ -245,8 +245,8 @@ struct sg2_geometry {
unsigned set_id;
unsigned segment_count_including_duplicates;
unsigned sides_with_defined_medium_count;
- unsigned seg_with_undef_sides_count;
- unsigned seg_with_undef_intface_count;
+ unsigned seg_with_unspecified_sides_count;
+ unsigned seg_with_unspecified_intface_count;
unsigned merge_conflict_count;
unsigned properties_conflict_count;
diff --git a/src/sg2_s2d_helper.h b/src/sg2_s2d_helper.h
@@ -34,7 +34,7 @@ sg2_s2d_geometry_get_indices__
const struct sg2_geometry* geometry = ctx;
res_T r;
ASSERT(indices && geometry);
- r = sg2_geometry_get_unique_segment_vertices(geometry, iseg, indices);
+ r = sg2_geometry_get_unique_primitive_vertices(geometry, iseg, indices);
ASSERT(r == RES_OK); (void)r;
}
diff --git a/src/sg2_senc2d_helper.h b/src/sg2_senc2d_helper.h
@@ -32,7 +32,7 @@ sg2_senc_geometry_get_indices__
const struct sg2_geometry* geometry = ctx;
res_T r;
ASSERT(indices && geometry);
- r = sg2_geometry_get_unique_segment_vertices(geometry, iseg, indices);
+ r = sg2_geometry_get_unique_primitive_vertices(geometry, iseg, indices);
ASSERT(r == RES_OK); (void)r;
}
@@ -48,12 +48,12 @@ sg2_senc_geometry_get_media__
unsigned tmp[SG2_PROP_TYPES_COUNT__];
res_T r;
ASSERT(media && geometry);
- r = sg2_geometry_get_unique_segment_properties(geometry, iseg, tmp);
+ r = sg2_geometry_get_unique_primitive_properties(geometry, iseg, tmp);
ASSERT(r == RES_OK); (void)r;
- media[SENC2D_FRONT] = (tmp[SG2_FRONT] == SG2_UNDEFINED_PROPERTY)
- ? SENC2D_UNDEFINED_MEDIUM : tmp[SG2_FRONT];
- media[SENC2D_BACK] = (tmp[SG2_BACK] == SG2_UNDEFINED_PROPERTY)
- ? SENC2D_UNDEFINED_MEDIUM : tmp[SG2_BACK];
+ media[SENC2D_FRONT] = (tmp[SG2_FRONT] == SG2_UNSPECIFIED_PROPERTY)
+ ? SENC2D_UNSPECIFIED_MEDIUM : tmp[SG2_FRONT];
+ media[SENC2D_BACK] = (tmp[SG2_BACK] == SG2_UNSPECIFIED_PROPERTY)
+ ? SENC2D_UNSPECIFIED_MEDIUM : tmp[SG2_BACK];
}
/* Get vertex indices for the iseg_th segment.
diff --git a/src/test_sg2_geometry.c b/src/test_sg2_geometry.c
@@ -102,45 +102,45 @@ main(int argc, char** argv)
BA(sg2_geometry_get_unique_vertices_count(NULL, &count));
OK(sg2_geometry_get_unique_vertices_count(geom, &count));
- BA(sg2_geometry_get_added_segments_count(NULL, NULL));
- BA(sg2_geometry_get_added_segments_count(geom, NULL));
- BA(sg2_geometry_get_added_segments_count(NULL, &count));
- OK(sg2_geometry_get_added_segments_count(geom, &count));
-
- BA(sg2_geometry_get_unique_segments_count(NULL, NULL));
- BA(sg2_geometry_get_unique_segments_count(geom, NULL));
- BA(sg2_geometry_get_unique_segments_count(NULL, &count));
- OK(sg2_geometry_get_unique_segments_count(geom, &count));
-
- BA(sg2_geometry_get_segment_with_undefined_side_count(NULL, NULL));
- BA(sg2_geometry_get_segment_with_undefined_side_count(geom, NULL));
- BA(sg2_geometry_get_segment_with_undefined_side_count(NULL, &count));
- OK(sg2_geometry_get_segment_with_undefined_side_count(geom, &count));
-
- BA(sg2_geometry_get_segment_with_undefined_interface_count(NULL, NULL));
- BA(sg2_geometry_get_segment_with_undefined_interface_count(geom, NULL));
- BA(sg2_geometry_get_segment_with_undefined_interface_count(NULL, &count));
- OK(sg2_geometry_get_segment_with_undefined_interface_count(geom, &count));
-
- BA(sg2_geometry_get_merge_conflict_count(NULL, NULL));
- BA(sg2_geometry_get_merge_conflict_count(geom, NULL));
- BA(sg2_geometry_get_merge_conflict_count(NULL, &count));
- OK(sg2_geometry_get_merge_conflict_count(geom, &count));
-
- BA(sg2_geometry_get_properties_conflict_count(NULL, NULL));
- BA(sg2_geometry_get_properties_conflict_count(geom, NULL));
- BA(sg2_geometry_get_properties_conflict_count(NULL, &count));
- OK(sg2_geometry_get_properties_conflict_count(geom, &count));
+ BA(sg2_geometry_get_added_primitives_count(NULL, NULL));
+ BA(sg2_geometry_get_added_primitives_count(geom, NULL));
+ BA(sg2_geometry_get_added_primitives_count(NULL, &count));
+ OK(sg2_geometry_get_added_primitives_count(geom, &count));
+
+ BA(sg2_geometry_get_unique_primitives_count(NULL, NULL));
+ BA(sg2_geometry_get_unique_primitives_count(geom, NULL));
+ BA(sg2_geometry_get_unique_primitives_count(NULL, &count));
+ OK(sg2_geometry_get_unique_primitives_count(geom, &count));
+
+ BA(sg2_geometry_get_unique_primitives_with_unspecified_side_count(NULL, NULL));
+ BA(sg2_geometry_get_unique_primitives_with_unspecified_side_count(geom, NULL));
+ BA(sg2_geometry_get_unique_primitives_with_unspecified_side_count(NULL, &count));
+ OK(sg2_geometry_get_unique_primitives_with_unspecified_side_count(geom, &count));
+
+ BA(sg2_geometry_get_unique_primitives_with_unspecified_interface_count(NULL, NULL));
+ BA(sg2_geometry_get_unique_primitives_with_unspecified_interface_count(geom, NULL));
+ BA(sg2_geometry_get_unique_primitives_with_unspecified_interface_count(NULL, &count));
+ OK(sg2_geometry_get_unique_primitives_with_unspecified_interface_count(geom, &count));
+
+ BA(sg2_geometry_get_unique_primitives_with_merge_conflict_count(NULL, NULL));
+ BA(sg2_geometry_get_unique_primitives_with_merge_conflict_count(geom, NULL));
+ BA(sg2_geometry_get_unique_primitives_with_merge_conflict_count(NULL, &count));
+ OK(sg2_geometry_get_unique_primitives_with_merge_conflict_count(geom, &count));
+
+ BA(sg2_geometry_get_unique_primitives_with_properties_conflict_count(NULL, NULL));
+ BA(sg2_geometry_get_unique_primitives_with_properties_conflict_count(geom, NULL));
+ BA(sg2_geometry_get_unique_primitives_with_properties_conflict_count(NULL, &count));
+ OK(sg2_geometry_get_unique_primitives_with_properties_conflict_count(geom, &count));
BA(sg2_geometry_dump_as_obj(NULL, NULL, 0));
BA(sg2_geometry_dump_as_obj(geom, NULL, 0));
BA(sg2_geometry_dump_as_obj(NULL, stdout, 0));
- BA(sg2_geometry_dump_as_obj(NULL, NULL, SG2_ALL_SEGMENTS));
+ BA(sg2_geometry_dump_as_obj(NULL, NULL, SG2_OBJ_DUMP_ALL));
BA(sg2_geometry_dump_as_obj(geom, stdout, 0));
- BA(sg2_geometry_dump_as_obj(geom, NULL, SG2_ALL_SEGMENTS));
- BA(sg2_geometry_dump_as_obj(NULL, stdout, SG2_ALL_SEGMENTS));
+ BA(sg2_geometry_dump_as_obj(geom, NULL, SG2_OBJ_DUMP_ALL));
+ BA(sg2_geometry_dump_as_obj(NULL, stdout, SG2_OBJ_DUMP_ALL));
/* BA because geometry is empty */
- BA(sg2_geometry_dump_as_obj(geom, stdout, SG2_ALL_SEGMENTS));
+ BA(sg2_geometry_dump_as_obj(geom, stdout, SG2_OBJ_DUMP_ALL));
BA(sg2_geometry_dump_as_vtk(NULL, NULL));
BA(sg2_geometry_dump_as_vtk(geom, NULL));
@@ -148,21 +148,21 @@ main(int argc, char** argv)
/* BA because geometry is empty */
BA(sg2_geometry_dump_as_vtk(geom, stdout));
- BA(sg2_geometry_dump_as_C_code(NULL, NULL, NULL, 0));
- BA(sg2_geometry_dump_as_C_code(geom, NULL, NULL, 0));
- BA(sg2_geometry_dump_as_C_code(NULL, stdout, NULL, 0));
- BA(sg2_geometry_dump_as_C_code(NULL, NULL, "test", 0));
- BA(sg2_geometry_dump_as_C_code(geom, NULL, "test", 0));
- BA(sg2_geometry_dump_as_C_code(NULL, stdout, "test", 0));
+ BA(sg2_geometry_dump_as_c_code(NULL, NULL, NULL, 0));
+ BA(sg2_geometry_dump_as_c_code(geom, NULL, NULL, 0));
+ BA(sg2_geometry_dump_as_c_code(NULL, stdout, NULL, 0));
+ BA(sg2_geometry_dump_as_c_code(NULL, NULL, "test", 0));
+ BA(sg2_geometry_dump_as_c_code(geom, NULL, "test", 0));
+ BA(sg2_geometry_dump_as_c_code(NULL, stdout, "test", 0));
/* BA because geometry is empty */
- BA(sg2_geometry_dump_as_C_code(geom, stdout, NULL, 0));
- BA(sg2_geometry_dump_as_C_code(geom, stdout, "test", 0));
+ BA(sg2_geometry_dump_as_c_code(geom, stdout, NULL, 0));
+ BA(sg2_geometry_dump_as_c_code(geom, stdout, "test", 0));
BA(sg2_geometry_add(NULL, 0, 0, &callbacks, NULL));
- OK(sg2_geometry_get_added_segments_count(geom, &count));
+ OK(sg2_geometry_get_added_primitives_count(geom, &count));
CHK(count == 0);
BA(sg2_geometry_add(geom, nsegments, nvertices, NULL, NULL));
- OK(sg2_geometry_get_added_segments_count(geom, &count));
+ OK(sg2_geometry_get_added_primitives_count(geom, &count));
CHK(count == nsegments);
/* 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(sg2_geometry_add(geom, 0, 0, &callbacks, NULL));
- OK(sg2_geometry_get_added_segments_count(geom, &count));
+ OK(sg2_geometry_get_added_primitives_count(geom, &count));
CHK(count == nsegments);
/* A 2D square.
@@ -195,11 +195,11 @@ main(int argc, char** argv)
callbacks.get_position = get_position;
OK(sg2_geometry_add(geom, nsegments, nvertices, &callbacks, &ctx));
- OK(sg2_geometry_dump_as_obj(geom, stdout, SG2_ALL_SEGMENTS));
+ OK(sg2_geometry_dump_as_obj(geom, stdout, SG2_OBJ_DUMP_ALL));
OK(sg2_geometry_dump_as_vtk(geom, stdout));
- OK(sg2_geometry_dump_as_C_code(geom, stdout, NULL, 0));
- OK(sg2_geometry_dump_as_C_code(geom, stdout, "test",
- SG2_CDUMP_STATIC | SG2_CDUMP_CONST));
+ OK(sg2_geometry_dump_as_c_code(geom, stdout, NULL, 0));
+ OK(sg2_geometry_dump_as_c_code(geom, stdout, "test",
+ SG2_C_DUMP_STATIC | SG2_C_DUMP_CONST));
BA(sg2_geometry_get_unique_vertex(NULL, nsegments, NULL));
BA(sg2_geometry_get_unique_vertex(geom, nsegments, NULL));
@@ -210,36 +210,36 @@ main(int argc, char** argv)
BA(sg2_geometry_get_unique_vertex(NULL, 0, coord));
OK(sg2_geometry_get_unique_vertex(geom, 0, coord));
- BA(sg2_geometry_get_unique_segment_vertices(NULL, nsegments, NULL));
- BA(sg2_geometry_get_unique_segment_vertices(geom, nsegments, NULL));
- BA(sg2_geometry_get_unique_segment_vertices(NULL, 0, NULL));
- BA(sg2_geometry_get_unique_segment_vertices(NULL, nsegments, indices));
- BA(sg2_geometry_get_unique_segment_vertices(geom, 0, NULL));
- BA(sg2_geometry_get_unique_segment_vertices(geom, nsegments, indices));
- BA(sg2_geometry_get_unique_segment_vertices(NULL, 0, indices));
- OK(sg2_geometry_get_unique_segment_vertices(geom, 0, indices));
+ BA(sg2_geometry_get_unique_primitive_vertices(NULL, nsegments, NULL));
+ BA(sg2_geometry_get_unique_primitive_vertices(geom, nsegments, NULL));
+ BA(sg2_geometry_get_unique_primitive_vertices(NULL, 0, NULL));
+ BA(sg2_geometry_get_unique_primitive_vertices(NULL, nsegments, indices));
+ BA(sg2_geometry_get_unique_primitive_vertices(geom, 0, NULL));
+ BA(sg2_geometry_get_unique_primitive_vertices(geom, nsegments, indices));
+ BA(sg2_geometry_get_unique_primitive_vertices(NULL, 0, indices));
+ OK(sg2_geometry_get_unique_primitive_vertices(geom, 0, indices));
FOR_EACH(i, 0 , 2) CHK(indices[i] == box_indices[i]);
- BA(sg2_geometry_get_unique_segment_properties(NULL, nsegments, NULL));
- BA(sg2_geometry_get_unique_segment_properties(geom, nsegments, NULL));
- BA(sg2_geometry_get_unique_segment_properties(NULL, 0, NULL));
- BA(sg2_geometry_get_unique_segment_properties(NULL, nsegments, properties));
- BA(sg2_geometry_get_unique_segment_properties(geom, 0, NULL));
- BA(sg2_geometry_get_unique_segment_properties(geom, nsegments, properties));
- BA(sg2_geometry_get_unique_segment_properties(NULL, 0, properties));
- OK(sg2_geometry_get_unique_segment_properties(geom, 0, properties));
+ BA(sg2_geometry_get_unique_primitive_properties(NULL, nsegments, NULL));
+ BA(sg2_geometry_get_unique_primitive_properties(geom, nsegments, NULL));
+ BA(sg2_geometry_get_unique_primitive_properties(NULL, 0, NULL));
+ BA(sg2_geometry_get_unique_primitive_properties(NULL, nsegments, properties));
+ BA(sg2_geometry_get_unique_primitive_properties(geom, 0, NULL));
+ BA(sg2_geometry_get_unique_primitive_properties(geom, nsegments, properties));
+ BA(sg2_geometry_get_unique_primitive_properties(NULL, 0, properties));
+ OK(sg2_geometry_get_unique_primitive_properties(geom, 0, properties));
CHK(medium0[0] == properties[SG2_FRONT]);
CHK(medium1[0] == properties[SG2_BACK]);
CHK(intface0[0] == properties[SG2_INTFACE]);
- BA(sg2_geometry_get_unique_segment_user_id(NULL, nsegments, NULL));
- BA(sg2_geometry_get_unique_segment_user_id(geom, nsegments, NULL));
- BA(sg2_geometry_get_unique_segment_user_id(NULL, 0, NULL));
- BA(sg2_geometry_get_unique_segment_user_id(NULL, nsegments, &user_id));
- BA(sg2_geometry_get_unique_segment_user_id(geom, 0, NULL));
- BA(sg2_geometry_get_unique_segment_user_id(geom, nsegments, &user_id));
- BA(sg2_geometry_get_unique_segment_user_id(NULL, 0, &user_id));
- OK(sg2_geometry_get_unique_segment_user_id(geom, 0, &user_id));
+ BA(sg2_geometry_get_unique_primitive_user_id(NULL, nsegments, NULL));
+ BA(sg2_geometry_get_unique_primitive_user_id(geom, nsegments, NULL));
+ BA(sg2_geometry_get_unique_primitive_user_id(NULL, 0, NULL));
+ BA(sg2_geometry_get_unique_primitive_user_id(NULL, nsegments, &user_id));
+ BA(sg2_geometry_get_unique_primitive_user_id(geom, 0, NULL));
+ BA(sg2_geometry_get_unique_primitive_user_id(geom, nsegments, &user_id));
+ BA(sg2_geometry_get_unique_primitive_user_id(NULL, 0, &user_id));
+ OK(sg2_geometry_get_unique_primitive_user_id(geom, 0, &user_id));
/* Due to a failed attempt to add nsegments segments, user_id for the
* first successfully added segment is shifted */
CHK(user_id == nsegments);
@@ -247,13 +247,13 @@ main(int argc, char** argv)
/* Conflicts with merge_seg callback */
callbacks.merge_segment = merge_seg;
OK(sg2_geometry_add(geom, nsegments, nvertices, &callbacks, &ctx));
- OK(sg2_geometry_get_merge_conflict_count(geom, &count));
+ OK(sg2_geometry_get_unique_primitives_with_merge_conflict_count(geom, &count));
/* Due to merge_seg internals, all but the first segment have conflict */
CHK(count == nsegments - 1);
- OK(sg2_geometry_dump_as_obj(geom, stdout, SG2_ALL_SEGMENTS));
+ OK(sg2_geometry_dump_as_obj(geom, stdout, SG2_OBJ_DUMP_ALL));
OK(sg2_geometry_dump_as_vtk(geom, stdout));
/* BA because of conflicts */
- BA(sg2_geometry_dump_as_C_code(geom, stdout, "test", SG2_CDUMP_STATIC));
+ BA(sg2_geometry_dump_as_c_code(geom, stdout, "test", SG2_C_DUMP_STATIC));
OK(sg2_geometry_ref_put(geom));
/* Conflicts without merge_seg callback */
@@ -262,13 +262,13 @@ main(int argc, char** argv)
OK(sg2_geometry_add(geom, nsegments, nvertices, &callbacks, &ctx));
ctx.front_media = medium1_top0;
OK(sg2_geometry_add(geom, nsegments, nvertices, &callbacks, &ctx));
- OK(sg2_geometry_get_merge_conflict_count(geom, &count));
+ OK(sg2_geometry_get_unique_primitives_with_merge_conflict_count(geom, &count));
FOR_EACH(i, 0, nsegments) if(medium0[i] != medium1_top0[i]) count--;
CHK(count == 0);
- OK(sg2_geometry_dump_as_obj(geom, stdout, SG2_ALL_SEGMENTS));
+ OK(sg2_geometry_dump_as_obj(geom, stdout, SG2_OBJ_DUMP_ALL));
OK(sg2_geometry_dump_as_vtk(geom, stdout));
/* BA because of conflicts */
- BA(sg2_geometry_dump_as_C_code(geom, stdout, "test", SG2_CDUMP_CONST));
+ BA(sg2_geometry_dump_as_c_code(geom, stdout, "test", SG2_C_DUMP_CONST));
/* Degenerated segments */
ctx.indices = degenerated;
diff --git a/src/test_sg2_geometry_2.c b/src/test_sg2_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] = SG2_UNDEFINED_PROPERTY;
+ for(i = 0; i < property_count; i++) property[i] = SG2_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(sg2_geometry_get_unique_vertices_count(geom, &count));
CHK(count == nvertices);
- OK(sg2_geometry_get_added_segments_count(geom, &count));
+ OK(sg2_geometry_get_added_primitives_count(geom, &count));
CHK(count == nsegments);
- OK(sg2_geometry_get_unique_segments_count(geom, &count));
+ OK(sg2_geometry_get_unique_primitives_count(geom, &count));
CHK(count == 0);
add_geom_ctx.add_res = RES_MEM_ERR;
ME(sg2_geometry_add(geom, nsegments, nvertices, &callbacks, &ctx));
CHK(add_geom_ctx.add_cpt == 0);
CHK(count == 0);
- OK(sg2_geometry_get_added_segments_count(geom, &count));
+ OK(sg2_geometry_get_added_primitives_count(geom, &count));
CHK(count == 2 * nsegments);
- OK(sg2_geometry_get_unique_segments_count(geom, &count));
+ OK(sg2_geometry_get_unique_primitives_count(geom, &count));
CHK(count == 0);
- OK(sg2_geometry_get_segment_with_undefined_side_count(geom, &count));
+ OK(sg2_geometry_get_unique_primitives_with_unspecified_side_count(geom, &count));
CHK(count == 0);
- OK(sg2_geometry_get_segment_with_undefined_interface_count(geom, &count));
+ OK(sg2_geometry_get_unique_primitives_with_unspecified_interface_count(geom, &count));
CHK(count == 0);
- OK(sg2_geometry_get_merge_conflict_count(geom, &count));
+ OK(sg2_geometry_get_unique_primitives_with_merge_conflict_count(geom, &count));
CHK(count == 0);
- OK(sg2_geometry_get_properties_conflict_count(geom, &count));
+ OK(sg2_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(sg2_geometry_get_unique_vertices_count(geom, &count));
CHK(count == nvertices);
- OK(sg2_geometry_get_added_segments_count(geom, &count));
+ OK(sg2_geometry_get_added_primitives_count(geom, &count));
CHK(count == 3 * nsegments);
- OK(sg2_geometry_get_unique_segments_count(geom, &count));
+ OK(sg2_geometry_get_unique_primitives_count(geom, &count));
CHK(count == nsegments);
- OK(sg2_geometry_get_segment_with_undefined_side_count(geom, &count));
+ OK(sg2_geometry_get_unique_primitives_with_unspecified_side_count(geom, &count));
CHK(count == nsegments);
- OK(sg2_geometry_get_segment_with_undefined_interface_count(geom, &count));
+ OK(sg2_geometry_get_unique_primitives_with_unspecified_interface_count(geom, &count));
CHK(count == nsegments);
- OK(sg2_geometry_get_merge_conflict_count(geom, &count));
+ OK(sg2_geometry_get_unique_primitives_with_merge_conflict_count(geom, &count));
CHK(count == 0);
- OK(sg2_geometry_get_properties_conflict_count(geom, &count));
+ OK(sg2_geometry_get_unique_primitives_with_properties_conflict_count(geom, &count));
CHK(count == 0);
- OK(sg2_geometry_dump_as_C_code(geom, stdout, "test_undefined",
- SG2_CDUMP_STATIC | SG2_CDUMP_CONST));
+ OK(sg2_geometry_dump_as_c_code(geom, stdout, "test_unspecified",
+ SG2_C_DUMP_STATIC | SG2_C_DUMP_CONST));
/* Clear geometry */
SG2(geometry_ref_put(geom));
@@ -190,17 +190,17 @@ main(int argc, char** argv)
CHK(add_geom_ctx.merge_cpt == 0);
OK(sg2_geometry_get_unique_vertices_count(geom, &count));
CHK(count == nvertices);
- OK(sg2_geometry_get_added_segments_count(geom, &count));
+ OK(sg2_geometry_get_added_primitives_count(geom, &count));
CHK(count == nsegments);
- OK(sg2_geometry_get_unique_segments_count(geom, &count));
+ OK(sg2_geometry_get_unique_primitives_count(geom, &count));
CHK(count == nsegments);
- OK(sg2_geometry_get_segment_with_undefined_side_count(geom, &count));
+ OK(sg2_geometry_get_unique_primitives_with_unspecified_side_count(geom, &count));
CHK(count == nsegments);
- OK(sg2_geometry_get_segment_with_undefined_interface_count(geom, &count));
+ OK(sg2_geometry_get_unique_primitives_with_unspecified_interface_count(geom, &count));
CHK(count == nsegments);
- OK(sg2_geometry_get_merge_conflict_count(geom, &count));
+ OK(sg2_geometry_get_unique_primitives_with_merge_conflict_count(geom, &count));
CHK(count == 0);
- OK(sg2_geometry_get_properties_conflict_count(geom, &count));
+ OK(sg2_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_segment = add_seg;
BA(sg2_geometry_add(geom, nsegments, nvertices, &callbacks, &ctx));
CHK(add_geom_ctx.merge_cpt == 0);
- OK(sg2_geometry_get_added_segments_count(geom, &count));
+ OK(sg2_geometry_get_added_primitives_count(geom, &count));
CHK(count == 2 * nsegments);
add_geom_ctx.merge_res = RES_MEM_ERR;
ME(sg2_geometry_add(geom, nsegments, nvertices, &callbacks, &ctx));
CHK(add_geom_ctx.merge_cpt == 0);
- OK(sg2_geometry_get_added_segments_count(geom, &count));
+ OK(sg2_geometry_get_added_primitives_count(geom, &count));
CHK(count == 3 * nsegments);
OK(sg2_geometry_get_unique_vertices_count(geom, &count));
CHK(count == nvertices);
- OK(sg2_geometry_get_unique_segments_count(geom, &count));
+ OK(sg2_geometry_get_unique_primitives_count(geom, &count));
CHK(count == nsegments);
- OK(sg2_geometry_get_segment_with_undefined_side_count(geom, &count));
+ OK(sg2_geometry_get_unique_primitives_with_unspecified_side_count(geom, &count));
CHK(count == nsegments);
- OK(sg2_geometry_get_segment_with_undefined_interface_count(geom, &count));
+ OK(sg2_geometry_get_unique_primitives_with_unspecified_interface_count(geom, &count));
CHK(count == nsegments);
- OK(sg2_geometry_get_merge_conflict_count(geom, &count));
+ OK(sg2_geometry_get_unique_primitives_with_merge_conflict_count(geom, &count));
CHK(count == 0); /* merge failed but with a no-conflict status */
- OK(sg2_geometry_get_properties_conflict_count(geom, &count));
+ OK(sg2_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(sg2_geometry_get_unique_vertices_count(geom, &count));
CHK(count == nvertices);
- OK(sg2_geometry_get_added_segments_count(geom, &count));
+ OK(sg2_geometry_get_added_primitives_count(geom, &count));
CHK(count == 4 * nsegments);
- OK(sg2_geometry_get_unique_segments_count(geom, &count));
+ OK(sg2_geometry_get_unique_primitives_count(geom, &count));
CHK(count == nsegments);
- OK(sg2_geometry_get_segment_with_undefined_side_count(geom, &count));
+ OK(sg2_geometry_get_unique_primitives_with_unspecified_side_count(geom, &count));
CHK(count == nsegments);
- OK(sg2_geometry_get_segment_with_undefined_interface_count(geom, &count));
+ OK(sg2_geometry_get_unique_primitives_with_unspecified_interface_count(geom, &count));
CHK(count == nsegments);
- OK(sg2_geometry_get_merge_conflict_count(geom, &count));
+ OK(sg2_geometry_get_unique_primitives_with_merge_conflict_count(geom, &count));
CHK(count == 0);
- OK(sg2_geometry_get_properties_conflict_count(geom, &count));
+ OK(sg2_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(sg2_geometry_get_unique_vertices_count(geom, &count));
CHK(count == nvertices);
- OK(sg2_geometry_get_added_segments_count(geom, &count));
+ OK(sg2_geometry_get_added_primitives_count(geom, &count));
CHK(count == 5 * nsegments);
- OK(sg2_geometry_get_unique_segments_count(geom, &count));
+ OK(sg2_geometry_get_unique_primitives_count(geom, &count));
CHK(count == nsegments);
- OK(sg2_geometry_get_segment_with_undefined_side_count(geom, &count));
+ OK(sg2_geometry_get_unique_primitives_with_unspecified_side_count(geom, &count));
CHK(count == nsegments);
- OK(sg2_geometry_get_segment_with_undefined_interface_count(geom, &count));
+ OK(sg2_geometry_get_unique_primitives_with_unspecified_interface_count(geom, &count));
CHK(count == nsegments);
- OK(sg2_geometry_get_merge_conflict_count(geom, &count));
+ OK(sg2_geometry_get_unique_primitives_with_merge_conflict_count(geom, &count));
CHK(count == 0); /* merge failed but with a no-conflict status */
- OK(sg2_geometry_get_properties_conflict_count(geom, &count));
+ OK(sg2_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 segments, then all of them */
add_geom_ctx.add_res = RES_OK;
OK(sg2_geometry_add(geom, nsegments / 2, nvertices, &callbacks, &ctx));
- OK(sg2_geometry_get_added_segments_count(geom, &count));
+ OK(sg2_geometry_get_added_primitives_count(geom, &count));
CHK(count == nsegments / 2);
OK(sg2_geometry_add(geom, nsegments, nvertices, &callbacks, &ctx));
CHK(add_geom_ctx.add_cpt == nsegments);
CHK(add_geom_ctx.merge_cpt == nsegments / 2);
add_geom_ctx.add_cpt = 0;
- OK(sg2_geometry_get_added_segments_count(geom, &count));
+ OK(sg2_geometry_get_added_primitives_count(geom, &count));
CHK(count == nsegments + nsegments / 2);
OK(sg2_geometry_get_unique_vertices_count(geom, &count));
CHK(count == nvertices);
- OK(sg2_geometry_get_unique_segments_count(geom, &count));
+ OK(sg2_geometry_get_unique_primitives_count(geom, &count));
CHK(count == nsegments);
- OK(sg2_geometry_get_segment_with_undefined_side_count(geom, &count));
+ OK(sg2_geometry_get_unique_primitives_with_unspecified_side_count(geom, &count));
CHK(count == 0); /* media where defined */
- OK(sg2_geometry_get_segment_with_undefined_interface_count(geom, &count));
- CHK(count == nsegments); /* interfaces where undefined */
- OK(sg2_geometry_get_merge_conflict_count(geom, &count));
+ OK(sg2_geometry_get_unique_primitives_with_unspecified_interface_count(geom, &count));
+ CHK(count == nsegments); /* interfaces where unspecified */
+ OK(sg2_geometry_get_unique_primitives_with_merge_conflict_count(geom, &count));
CHK(count == 0);
- OK(sg2_geometry_get_properties_conflict_count(geom, &count));
+ OK(sg2_geometry_get_unique_primitives_with_properties_conflict_count(geom, &count));
CHK(count == 0);
OK(sg2_geometry_dump_as_vtk(geom, stdout));
/* Second add was half duplicated, so numbering is shifted */
FOR_EACH(i, 0, nsegments) {
unsigned id;
- OK(sg2_geometry_get_unique_segment_user_id(geom, i, &id));
+ OK(sg2_geometry_get_unique_primitive_user_id(geom, i, &id));
CHK(i < nsegments / 2 ? id == i : id == i + nsegments / 2);
}
@@ -322,17 +322,17 @@ main(int argc, char** argv)
add_geom_ctx.add_cpt = 0;
OK(sg2_geometry_get_unique_vertices_count(geom, &count));
CHK(count == nvertices);
- OK(sg2_geometry_get_added_segments_count(geom, &count));
+ OK(sg2_geometry_get_added_primitives_count(geom, &count));
CHK(count == nsegments);
- OK(sg2_geometry_get_unique_segments_count(geom, &count));
+ OK(sg2_geometry_get_unique_primitives_count(geom, &count));
CHK(count == nsegments);
- OK(sg2_geometry_get_segment_with_undefined_side_count(geom, &count));
- CHK(count == nsegments); /* media where undefined */
- OK(sg2_geometry_get_segment_with_undefined_interface_count(geom, &count));
- CHK(count == nsegments); /* interfaces where undefined */
- OK(sg2_geometry_get_merge_conflict_count(geom, &count));
+ OK(sg2_geometry_get_unique_primitives_with_unspecified_side_count(geom, &count));
+ CHK(count == nsegments); /* media where unspecified */
+ OK(sg2_geometry_get_unique_primitives_with_unspecified_interface_count(geom, &count));
+ CHK(count == nsegments); /* interfaces where unspecified */
+ OK(sg2_geometry_get_unique_primitives_with_merge_conflict_count(geom, &count));
CHK(count == 0);
- OK(sg2_geometry_get_properties_conflict_count(geom, &count));
+ OK(sg2_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(sg2_geometry_get_unique_vertices_count(geom, &count));
CHK(count == nvertices);
- OK(sg2_geometry_get_added_segments_count(geom, &count));
+ OK(sg2_geometry_get_added_primitives_count(geom, &count));
CHK(count == 2 * nsegments);
- OK(sg2_geometry_get_unique_segments_count(geom, &count));
+ OK(sg2_geometry_get_unique_primitives_count(geom, &count));
CHK(count == nsegments);
- OK(sg2_geometry_get_segment_with_undefined_side_count(geom, &count));
+ OK(sg2_geometry_get_unique_primitives_with_unspecified_side_count(geom, &count));
CHK(count == 0); /* media where defined */
- OK(sg2_geometry_get_segment_with_undefined_interface_count(geom, &count));
+ OK(sg2_geometry_get_unique_primitives_with_unspecified_interface_count(geom, &count));
CHK(count == 0); /* interfaces where defined */
- OK(sg2_geometry_get_merge_conflict_count(geom, &count));
+ OK(sg2_geometry_get_unique_primitives_with_merge_conflict_count(geom, &count));
CHK(count == 0);
- OK(sg2_geometry_get_properties_conflict_count(geom, &count));
+ OK(sg2_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(sg2_geometry_get_unique_vertices_count(geom, &count));
CHK(count == nvertices);
- OK(sg2_geometry_get_added_segments_count(geom, &count));
+ OK(sg2_geometry_get_added_primitives_count(geom, &count));
CHK(count == 3 * nsegments);
- OK(sg2_geometry_get_unique_segments_count(geom, &count));
+ OK(sg2_geometry_get_unique_primitives_count(geom, &count));
CHK(count == nsegments);
- OK(sg2_geometry_get_segment_with_undefined_side_count(geom, &count));
+ OK(sg2_geometry_get_unique_primitives_with_unspecified_side_count(geom, &count));
CHK(count == 0); /* media where defined */
- OK(sg2_geometry_get_segment_with_undefined_interface_count(geom, &count));
+ OK(sg2_geometry_get_unique_primitives_with_unspecified_interface_count(geom, &count));
CHK(count == 0); /* interfaces where defined */
- OK(sg2_geometry_get_merge_conflict_count(geom, &count));
+ OK(sg2_geometry_get_unique_primitives_with_merge_conflict_count(geom, &count));
CHK(count == nsegments);
- OK(sg2_geometry_get_properties_conflict_count(geom, &count));
+ OK(sg2_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(sg2_geometry_get_unique_vertices_count(geom, &count));
CHK(count == nvertices);
- OK(sg2_geometry_get_added_segments_count(geom, &count));
+ OK(sg2_geometry_get_added_primitives_count(geom, &count));
CHK(count == 4 * nsegments);
- OK(sg2_geometry_get_unique_segments_count(geom, &count));
+ OK(sg2_geometry_get_unique_primitives_count(geom, &count));
CHK(count == nsegments);
- OK(sg2_geometry_get_segment_with_undefined_side_count(geom, &count));
+ OK(sg2_geometry_get_unique_primitives_with_unspecified_side_count(geom, &count));
CHK(count == 0); /* media where defined */
- OK(sg2_geometry_get_segment_with_undefined_interface_count(geom, &count));
+ OK(sg2_geometry_get_unique_primitives_with_unspecified_interface_count(geom, &count));
CHK(count == 0); /* interfaces where defined */
- OK(sg2_geometry_get_merge_conflict_count(geom, &count));
+ OK(sg2_geometry_get_unique_primitives_with_merge_conflict_count(geom, &count));
CHK(count == nsegments);
- OK(sg2_geometry_get_properties_conflict_count(geom, &count));
+ OK(sg2_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(sg2_geometry_add(geom, nsegments, nvertices, &callbacks, &ctx));
- OK(sg2_geometry_get_merge_conflict_count(geom, &count));
+ OK(sg2_geometry_get_unique_primitives_with_merge_conflict_count(geom, &count));
CHK(count == 0);
OK(sg2_geometry_validate_properties(geom, validate, NULL));
- OK(sg2_geometry_get_properties_conflict_count(geom, &count));
+ OK(sg2_geometry_get_unique_primitives_with_properties_conflict_count(geom, &count));
CHK(count == 0);
- OK(sg2_geometry_dump_as_obj(geom, stdout, SG2_ALL_SEGMENTS));
+ OK(sg2_geometry_dump_as_obj(geom, stdout, SG2_OBJ_DUMP_ALL));
OK(sg2_geometry_validate_properties(geom, validate, NULL));
- OK(sg2_geometry_get_properties_conflict_count(geom, &count));
+ OK(sg2_geometry_get_unique_primitives_with_properties_conflict_count(geom, &count));
CHK(count == 0);
OK(sg2_geometry_validate_properties(geom, validate2, NULL));
- OK(sg2_geometry_get_properties_conflict_count(geom, &count));
+ OK(sg2_geometry_get_unique_primitives_with_properties_conflict_count(geom, &count));
CHK(count == nsegments / 2);
OK(sg2_geometry_ref_put(geom));
diff --git a/src/test_sg2_many_enclosures.c b/src/test_sg2_many_enclosures.c
@@ -86,13 +86,13 @@ main(int argc, char** argv)
}
circle_release(&ctx);
- OK(sg2_geometry_get_merge_conflict_count(geom, &count));
+ OK(sg2_geometry_get_unique_primitives_with_merge_conflict_count(geom, &count));
CHK(count == 0);
- OK(sg2_geometry_get_segment_with_undefined_interface_count(geom, &count));
+ OK(sg2_geometry_get_unique_primitives_with_unspecified_interface_count(geom, &count));
CHK(count == 0);
- OK(sg2_geometry_get_segment_with_undefined_side_count(geom, &count));
+ OK(sg2_geometry_get_unique_primitives_with_unspecified_side_count(geom, &count));
CHK(count == 0);
- OK(sg2_geometry_dump_as_obj(geom, stdout, SG2_ALL_SEGMENTS));
+ OK(sg2_geometry_dump_as_obj(geom, stdout, SG2_OBJ_DUMP_ALL));
SG2(geometry_ref_put(geom));
diff --git a/src/test_sg2_many_segments.c b/src/test_sg2_many_segments.c
@@ -67,13 +67,13 @@ main(int argc, char** argv)
}
circle_release(&ctx);
- OK(sg2_geometry_get_merge_conflict_count(geom, &count));
+ OK(sg2_geometry_get_unique_primitives_with_merge_conflict_count(geom, &count));
CHK(count == 0);
- OK(sg2_geometry_get_segment_with_undefined_interface_count(geom, &count));
+ OK(sg2_geometry_get_unique_primitives_with_unspecified_interface_count(geom, &count));
CHK(count == 0);
- OK(sg2_geometry_get_segment_with_undefined_side_count(geom, &count));
+ OK(sg2_geometry_get_unique_primitives_with_unspecified_side_count(geom, &count));
CHK(count == 0);
- OK(sg2_geometry_dump_as_obj(geom, stdout, SG2_ALL_SEGMENTS));
+ OK(sg2_geometry_dump_as_obj(geom, stdout, SG2_OBJ_DUMP_ALL));
SG2(geometry_ref_put(geom));
diff --git a/src/test_sg2_some_enclosures.c b/src/test_sg2_some_enclosures.c
@@ -86,14 +86,14 @@ main(int argc, char** argv)
}
circle_release(&ctx);
- OK(sg2_geometry_get_merge_conflict_count(geom, &count));
+ OK(sg2_geometry_get_unique_primitives_with_merge_conflict_count(geom, &count));
CHK(count == 0);
- OK(sg2_geometry_get_segment_with_undefined_interface_count(geom, &count));
+ OK(sg2_geometry_get_unique_primitives_with_unspecified_interface_count(geom, &count));
CHK(count == 0);
- OK(sg2_geometry_get_segment_with_undefined_side_count(geom, &count));
+ OK(sg2_geometry_get_unique_primitives_with_unspecified_side_count(geom, &count));
CHK(count == 0);
- OK(sg2_geometry_dump_as_C_code(geom, stdout, "some_enclosures",
- SG2_CDUMP_CONST | SG2_CDUMP_STATIC));
+ OK(sg2_geometry_dump_as_c_code(geom, stdout, "some_enclosures",
+ SG2_C_DUMP_CONST | SG2_C_DUMP_STATIC));
SG2(geometry_ref_put(geom));
diff --git a/src/test_sg2_some_segments.c b/src/test_sg2_some_segments.c
@@ -68,15 +68,15 @@ main(int argc, char** argv)
}
circle_release(&ctx);
- OK(sg2_geometry_get_merge_conflict_count(geom, &count));
+ OK(sg2_geometry_get_unique_primitives_with_merge_conflict_count(geom, &count));
CHK(count == 0);
- OK(sg2_geometry_get_segment_with_undefined_interface_count(geom, &count));
+ OK(sg2_geometry_get_unique_primitives_with_unspecified_interface_count(geom, &count));
CHK(count == 0);
- OK(sg2_geometry_get_segment_with_undefined_side_count(geom, &count));
+ OK(sg2_geometry_get_unique_primitives_with_unspecified_side_count(geom, &count));
CHK(count == 0);
- OK(sg2_geometry_dump_as_C_code(geom, stdout, "some_segments",
- SG2_CDUMP_CONST | SG2_CDUMP_STATIC));
+ OK(sg2_geometry_dump_as_c_code(geom, stdout, "some_segments",
+ SG2_C_DUMP_CONST | SG2_C_DUMP_STATIC));
SG2(geometry_ref_put(geom));
diff --git a/src/test_sg2_square_behind_square.c b/src/test_sg2_square_behind_square.c
@@ -82,14 +82,14 @@ main(int argc, char** argv)
/* Second square (front: 0, back: 1), right-handed normal outside */
OK(sg2_geometry_add(geom, nsegments, nvertices, &callbacks, &ctx));
- OK(sg2_geometry_get_merge_conflict_count(geom, &count));
+ OK(sg2_geometry_get_unique_primitives_with_merge_conflict_count(geom, &count));
CHK(count == 0);
- OK(sg2_geometry_get_segment_with_undefined_interface_count(geom, &count));
+ OK(sg2_geometry_get_unique_primitives_with_unspecified_interface_count(geom, &count));
CHK(count == 0);
- OK(sg2_geometry_get_segment_with_undefined_side_count(geom, &count));
+ OK(sg2_geometry_get_unique_primitives_with_unspecified_side_count(geom, &count));
CHK(count == 0);
- OK(sg2_geometry_dump_as_C_code(geom, stdout, "square_behind_square_2",
- SG2_CDUMP_CONST | SG2_CDUMP_STATIC));
+ OK(sg2_geometry_dump_as_c_code(geom, stdout, "square_behind_square_2",
+ SG2_C_DUMP_CONST | SG2_C_DUMP_STATIC));
d2(ctx.offset, -1, 6);
ctx.scale = 5;
@@ -99,14 +99,14 @@ main(int argc, char** argv)
/* Third square (front: 1, back: 0), right-handed normal outside */
OK(sg2_geometry_add(geom, nsegments, nvertices, &callbacks, &ctx));
- OK(sg2_geometry_get_merge_conflict_count(geom, &count));
+ OK(sg2_geometry_get_unique_primitives_with_merge_conflict_count(geom, &count));
CHK(count == 0);
- OK(sg2_geometry_get_segment_with_undefined_interface_count(geom, &count));
+ OK(sg2_geometry_get_unique_primitives_with_unspecified_interface_count(geom, &count));
CHK(count == 0);
- OK(sg2_geometry_get_segment_with_undefined_side_count(geom, &count));
+ OK(sg2_geometry_get_unique_primitives_with_unspecified_side_count(geom, &count));
CHK(count == 0);
- OK(sg2_geometry_dump_as_C_code(geom, stdout, "square_behind_square_3",
- SG2_CDUMP_CONST | SG2_CDUMP_STATIC));
+ OK(sg2_geometry_dump_as_c_code(geom, stdout, "square_behind_square_3",
+ SG2_C_DUMP_CONST | SG2_C_DUMP_STATIC));
SG2(geometry_ref_put(geom));
diff --git a/src/test_sg2_square_in_square.c b/src/test_sg2_square_in_square.c
@@ -73,14 +73,14 @@ main(int argc, char** argv)
/* Second square (front: 0, back: 1), right-handed normal inside */
OK(sg2_geometry_add(geom, nsegments, nvertices, &callbacks, &ctx));
- OK(sg2_geometry_get_merge_conflict_count(geom, &count));
+ OK(sg2_geometry_get_unique_primitives_with_merge_conflict_count(geom, &count));
CHK(count == 0);
- OK(sg2_geometry_get_segment_with_undefined_interface_count(geom, &count));
+ OK(sg2_geometry_get_unique_primitives_with_unspecified_interface_count(geom, &count));
CHK(count == 0);
- OK(sg2_geometry_get_segment_with_undefined_side_count(geom, &count));
+ OK(sg2_geometry_get_unique_primitives_with_unspecified_side_count(geom, &count));
CHK(count == 0);
- OK(sg2_geometry_dump_as_C_code(geom, stdout, "square_in_square_2",
- SG2_CDUMP_CONST | SG2_CDUMP_STATIC));
+ OK(sg2_geometry_dump_as_c_code(geom, stdout, "square_in_square_2",
+ SG2_C_DUMP_CONST | SG2_C_DUMP_STATIC));
d2(ctx.offset, -4, -4);
ctx.scale = 10;
@@ -92,14 +92,14 @@ main(int argc, char** argv)
/* Third square (front: 0, back: 1), right-handed normal inside */
OK(sg2_geometry_add(geom, nsegments, nvertices, &callbacks, &ctx));
- OK(sg2_geometry_get_merge_conflict_count(geom, &count));
+ OK(sg2_geometry_get_unique_primitives_with_merge_conflict_count(geom, &count));
CHK(count == 0);
- OK(sg2_geometry_get_segment_with_undefined_interface_count(geom, &count));
+ OK(sg2_geometry_get_unique_primitives_with_unspecified_interface_count(geom, &count));
CHK(count == 0);
- OK(sg2_geometry_get_segment_with_undefined_side_count(geom, &count));
+ OK(sg2_geometry_get_unique_primitives_with_unspecified_side_count(geom, &count));
CHK(count == 0);
- OK(sg2_geometry_dump_as_C_code(geom, stdout, "square_in_square_3",
- SG2_CDUMP_CONST | SG2_CDUMP_STATIC));
+ OK(sg2_geometry_dump_as_c_code(geom, stdout, "square_in_square_3",
+ SG2_C_DUMP_CONST | SG2_C_DUMP_STATIC));
SG2(geometry_ref_put(geom));
diff --git a/src/test_sg2_square_on_square.c b/src/test_sg2_square_on_square.c
@@ -83,14 +83,14 @@ main(int argc, char** argv)
/* Third square (front: 2, back: 1), right-handed normal inside */
OK(sg2_geometry_add(geom, nsegments, nvertices, &callbacks, &ctx));
- OK(sg2_geometry_get_merge_conflict_count(geom, &count));
+ OK(sg2_geometry_get_unique_primitives_with_merge_conflict_count(geom, &count));
CHK(count == 0);
- OK(sg2_geometry_get_segment_with_undefined_interface_count(geom, &count));
+ OK(sg2_geometry_get_unique_primitives_with_unspecified_interface_count(geom, &count));
CHK(count == 0);
- OK(sg2_geometry_get_segment_with_undefined_side_count(geom, &count));
+ OK(sg2_geometry_get_unique_primitives_with_unspecified_side_count(geom, &count));
CHK(count == 0);
- OK(sg2_geometry_dump_as_C_code(geom, stdout, "square_on_square",
- SG2_CDUMP_CONST | SG2_CDUMP_STATIC));
+ OK(sg2_geometry_dump_as_c_code(geom, stdout, "square_on_square",
+ SG2_C_DUMP_CONST | SG2_C_DUMP_STATIC));
SG2(geometry_ref_put(geom));
diff --git a/src/test_sg2_undefined_properties.c b/src/test_sg2_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 "sg2.h"
-#include "test_sg2_utils.h"
-
-#include <stdio.h>
-
-int
-main(int argc, char** argv)
-{
- struct mem_allocator allocator;
- struct sg2_device* dev;
- struct sg2_geometry* geom;
- struct context ctx = CONTEXT_NULL__;
- struct sg2_geometry_add_callbacks callbacks = SG2_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(sg2_device_create(NULL, &allocator, 1, &dev));
- OK(sg2_geometry_create(dev, &geom));
-
- FOR_EACH(i, 0, property_count) property[i] = SG2_UNDEFINED_PROPERTY;
-
- callbacks.get_indices = get_indices;
- callbacks.get_position = get_position;
-
- /* A 3D square.
- * 2 enclosures (inside, outside) sharing the same segments,
- * but opposite sides */
- ctx.positions = box_vertices;
- ctx.indices = box_indices;
-
- /* Add geometry with no properties */
- ctx.front_media = property;
- ctx.back_media = medium1;
- ctx.intface = property;
- OK(sg2_geometry_add(geom, nsegments, nvertices, &callbacks, &ctx));
- OK(sg2_geometry_get_segment_with_undefined_side_count(geom, &count));
- CHK(count == nsegments);
- OK(sg2_geometry_get_added_segments_count(geom, &count));
- CHK(count == nsegments);
-
- /* Add same geometry with no properties on front/intface */
- callbacks.get_properties = get_properties;
- OK(sg2_geometry_add(geom, nsegments, nvertices, &callbacks, &ctx));
- OK(sg2_geometry_get_segment_with_undefined_side_count(geom, &count));
- CHK(count == nsegments);
- OK(sg2_geometry_get_added_segments_count(geom, &count));
- CHK(count == 2 * nsegments);
-
- OK(sg2_geometry_dump_as_C_code(geom, stdout, "front_undefined",
- SG2_CDUMP_STATIC | SG2_CDUMP_CONST));
-
- /* Add same geometry, front/intface properties are defined for odd segments */
- FOR_EACH(i, 0, sizeof(property) / sizeof(*property))
- property[i] = (i % 2) ? 0 : SG2_UNDEFINED_PROPERTY;
- OK(sg2_geometry_add(geom, nsegments, nvertices, &callbacks, &ctx));
- OK(sg2_geometry_get_segment_with_undefined_side_count(geom, &count));
- CHK(count == nsegments / 2);
- OK(sg2_geometry_get_unique_vertices_count(geom, &count));
- CHK(count == nvertices);
- OK(sg2_geometry_get_added_segments_count(geom, &count));
- CHK(count == 3 * nsegments);
- OK(sg2_geometry_get_unique_segments_count(geom, &count));
- CHK(count == nsegments);
- FOR_EACH(i, 0, count) {
- unsigned prop[SG2_PROP_TYPES_COUNT__];
- OK(sg2_geometry_get_unique_segment_properties(geom, i, prop));
- CHK(prop[SG2_FRONT] == ((i % 2) ? 0 : SG2_UNDEFINED_PROPERTY)
- && prop[SG2_BACK] == 1
- && prop[SG2_INTFACE] == ((i % 2) ? 0 : SG2_UNDEFINED_PROPERTY));
- }
-
- /* Same information again, using a reversed box */
- ctx.reverse_vrtx = 1;
- SWAP(const unsigned*, ctx.front_media, ctx.back_media);
- OK(sg2_geometry_add(geom, nsegments, nvertices, &callbacks, &ctx));
- OK(sg2_geometry_get_segment_with_undefined_side_count(geom, &count));
- CHK(count == nsegments / 2);
- OK(sg2_geometry_get_added_segments_count(geom, &count));
- CHK(count == 4 * nsegments);
-
- OK(sg2_geometry_dump_as_C_code(geom, stdout, "front_half_undefined",
- SG2_CDUMP_STATIC | SG2_CDUMP_CONST));
-
- /* Define properties for remaining segments, using reversed box */
- FOR_EACH(i, 0, sizeof(property) / sizeof(*property))
- property[i] = (i % 2) ? SG2_UNDEFINED_PROPERTY : 0;
- OK(sg2_geometry_add(geom, nsegments, nvertices, &callbacks, &ctx));
- OK(sg2_geometry_get_segment_with_undefined_side_count(geom, &count));
- CHK(count == 0);
- OK(sg2_geometry_get_unique_vertices_count(geom, &count));
- CHK(count == nvertices);
- OK(sg2_geometry_get_added_segments_count(geom, &count));
- CHK(count == 5 * nsegments);
- OK(sg2_geometry_get_unique_segments_count(geom, &count));
- CHK(count == nsegments);
- FOR_EACH(i, 0, count) {
- unsigned prop[SG2_PROP_TYPES_COUNT__];
- OK(sg2_geometry_get_unique_segment_properties(geom, i, prop));
- CHK(prop[SG2_FRONT] == 0 && prop[SG2_BACK] == 1
- && prop[SG2_INTFACE] == 0);
- }
-
- OK(sg2_geometry_dump_as_C_code(geom, stdout, "all_defined",
- SG2_CDUMP_STATIC | SG2_CDUMP_CONST));
-
- /* Define incoherent properties for some segments */
- FOR_EACH(i, 0, sizeof(property) / sizeof(*property))
- property[i] = (i % 2);
- OK(sg2_geometry_add(geom, nsegments, nvertices, &callbacks, &ctx));
- OK(sg2_geometry_get_merge_conflict_count(geom, &count));
- CHK(count == nsegments / 2);
- OK(sg2_geometry_get_properties_conflict_count(geom, &count));
- CHK(count == 0);
- OK(sg2_geometry_get_added_segments_count(geom, &count));
- CHK(count == 6 * nsegments);
-
- OK(sg2_geometry_ref_put(geom));
- OK(sg2_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_sg2_unspecified_properties.c b/src/test_sg2_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 "sg2.h"
+#include "test_sg2_utils.h"
+
+#include <stdio.h>
+
+int
+main(int argc, char** argv)
+{
+ struct mem_allocator allocator;
+ struct sg2_device* dev;
+ struct sg2_geometry* geom;
+ struct context ctx = CONTEXT_NULL__;
+ struct sg2_geometry_add_callbacks callbacks = SG2_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(sg2_device_create(NULL, &allocator, 1, &dev));
+ OK(sg2_geometry_create(dev, &geom));
+
+ FOR_EACH(i, 0, property_count) property[i] = SG2_UNSPECIFIED_PROPERTY;
+
+ callbacks.get_indices = get_indices;
+ callbacks.get_position = get_position;
+
+ /* A 3D square.
+ * 2 enclosures (inside, outside) sharing the same segments,
+ * but opposite sides */
+ ctx.positions = box_vertices;
+ ctx.indices = box_indices;
+
+ /* Add geometry with no properties */
+ ctx.front_media = property;
+ ctx.back_media = medium1;
+ ctx.intface = property;
+ OK(sg2_geometry_add(geom, nsegments, nvertices, &callbacks, &ctx));
+ OK(sg2_geometry_get_unique_primitives_with_unspecified_side_count(geom, &count));
+ CHK(count == nsegments);
+ OK(sg2_geometry_get_added_primitives_count(geom, &count));
+ CHK(count == nsegments);
+
+ /* Add same geometry with no properties on front/intface */
+ callbacks.get_properties = get_properties;
+ OK(sg2_geometry_add(geom, nsegments, nvertices, &callbacks, &ctx));
+ OK(sg2_geometry_get_unique_primitives_with_unspecified_side_count(geom, &count));
+ CHK(count == nsegments);
+ OK(sg2_geometry_get_added_primitives_count(geom, &count));
+ CHK(count == 2 * nsegments);
+
+ OK(sg2_geometry_dump_as_c_code(geom, stdout, "front_unspecified",
+ SG2_C_DUMP_STATIC | SG2_C_DUMP_CONST));
+
+ /* Add same geometry, front/intface properties are defined for odd segments */
+ FOR_EACH(i, 0, sizeof(property) / sizeof(*property))
+ property[i] = (i % 2) ? 0 : SG2_UNSPECIFIED_PROPERTY;
+ OK(sg2_geometry_add(geom, nsegments, nvertices, &callbacks, &ctx));
+ OK(sg2_geometry_get_unique_primitives_with_unspecified_side_count(geom, &count));
+ CHK(count == nsegments / 2);
+ OK(sg2_geometry_get_unique_vertices_count(geom, &count));
+ CHK(count == nvertices);
+ OK(sg2_geometry_get_added_primitives_count(geom, &count));
+ CHK(count == 3 * nsegments);
+ OK(sg2_geometry_get_unique_primitives_count(geom, &count));
+ CHK(count == nsegments);
+ FOR_EACH(i, 0, count) {
+ unsigned prop[SG2_PROP_TYPES_COUNT__];
+ OK(sg2_geometry_get_unique_primitive_properties(geom, i, prop));
+ CHK(prop[SG2_FRONT] == ((i % 2) ? 0 : SG2_UNSPECIFIED_PROPERTY)
+ && prop[SG2_BACK] == 1
+ && prop[SG2_INTFACE] == ((i % 2) ? 0 : SG2_UNSPECIFIED_PROPERTY));
+ }
+
+ /* Same information again, using a reversed box */
+ ctx.reverse_vrtx = 1;
+ SWAP(const unsigned*, ctx.front_media, ctx.back_media);
+ OK(sg2_geometry_add(geom, nsegments, nvertices, &callbacks, &ctx));
+ OK(sg2_geometry_get_unique_primitives_with_unspecified_side_count(geom, &count));
+ CHK(count == nsegments / 2);
+ OK(sg2_geometry_get_added_primitives_count(geom, &count));
+ CHK(count == 4 * nsegments);
+
+ OK(sg2_geometry_dump_as_c_code(geom, stdout, "front_half_unspecified",
+ SG2_C_DUMP_STATIC | SG2_C_DUMP_CONST));
+
+ /* Define properties for remaining segments, using reversed box */
+ FOR_EACH(i, 0, sizeof(property) / sizeof(*property))
+ property[i] = (i % 2) ? SG2_UNSPECIFIED_PROPERTY : 0;
+ OK(sg2_geometry_add(geom, nsegments, nvertices, &callbacks, &ctx));
+ OK(sg2_geometry_get_unique_primitives_with_unspecified_side_count(geom, &count));
+ CHK(count == 0);
+ OK(sg2_geometry_get_unique_vertices_count(geom, &count));
+ CHK(count == nvertices);
+ OK(sg2_geometry_get_added_primitives_count(geom, &count));
+ CHK(count == 5 * nsegments);
+ OK(sg2_geometry_get_unique_primitives_count(geom, &count));
+ CHK(count == nsegments);
+ FOR_EACH(i, 0, count) {
+ unsigned prop[SG2_PROP_TYPES_COUNT__];
+ OK(sg2_geometry_get_unique_primitive_properties(geom, i, prop));
+ CHK(prop[SG2_FRONT] == 0 && prop[SG2_BACK] == 1
+ && prop[SG2_INTFACE] == 0);
+ }
+
+ OK(sg2_geometry_dump_as_c_code(geom, stdout, "all_defined",
+ SG2_C_DUMP_STATIC | SG2_C_DUMP_CONST));
+
+ /* Define incoherent properties for some segments */
+ FOR_EACH(i, 0, sizeof(property) / sizeof(*property))
+ property[i] = (i % 2);
+ OK(sg2_geometry_add(geom, nsegments, nvertices, &callbacks, &ctx));
+ OK(sg2_geometry_get_unique_primitives_with_merge_conflict_count(geom, &count));
+ CHK(count == nsegments / 2);
+ OK(sg2_geometry_get_unique_primitives_with_properties_conflict_count(geom, &count));
+ CHK(count == 0);
+ OK(sg2_geometry_get_added_primitives_count(geom, &count));
+ CHK(count == 6 * nsegments);
+
+ OK(sg2_geometry_ref_put(geom));
+ OK(sg2_device_ref_put(dev));
+
+ check_memory_allocator(&allocator);
+ mem_shutdown_proxy_allocator(&allocator);
+ CHK(mem_allocated_size() == 0);
+ return 0;
+}