![]() | ![]() | ![]() | gts Reference Manual | ![]() |
---|
#define GTS_C_VAR extern const guint gts_major_version; extern const guint gts_minor_version; extern const guint gts_micro_version; extern const guint gts_interface_age; extern const guint gts_binary_age; #define GTS_CHECK_VERSION (major,minor,micro) #define GTS_COMMENTS #define GTS_MAINTAINER GtsObjectClassInfo;void (*GtsObjectClassInitFunc) (GtsObjectClass *objclass);void (*GtsObjectInitFunc) (GtsObject *obj);void (*GtsArgSetFunc) (GtsObject *obj);void (*GtsArgGetFunc) (GtsObject *obj); typedef GtsVector; typedef GtsVector4; typedef GtsMatrix;gdouble (*GtsKeyFunc) (gpointer item,gpointer data); enum GtsIntersect; GtsColor;gint (*GtsFunc) (gpointer item,gpointer data); GtsFile; enum GtsTokenType; GtsFileVariable; GtsFile * gts_file_new (FILE *fp); GtsFile * gts_file_new_from_string (gchar *s); GtsFile * gts_file_new_from_buffer (gchar *buf,size_t len);void gts_file_verror (GtsFile *f, constgchar *format,va_list args);void gts_file_error (GtsFile *f, constgchar *format, ...);gint gts_file_getc (GtsFile *f);guint gts_file_read (GtsFile *f,gpointer ptr,guint size,guint nmemb);gint gts_file_getc_scope (GtsFile *f);void gts_file_next_token (GtsFile *f);void gts_file_first_token_after (GtsFile *f, GtsTokenType type);void gts_file_assign_start (GtsFile *f, GtsFileVariable *vars); GtsFileVariable * gts_file_assign_next (GtsFile *f, GtsFileVariable *vars);void gts_file_assign_variables (GtsFile *f, GtsFileVariable *vars);void gts_file_variable_error (GtsFile *f, GtsFileVariable *vars, constgchar *name, constgchar *format, ...);void gts_file_destroy (GtsFile *f); #define GTS_OBJECT_CAST (obj, type, klass) #define GTS_OBJECT_CLASS_CAST (objklass, type, klass) #define GTS_CLASS_NAME_LENGTH enum GtsObjectFlags; #define GTS_OBJECT_FLAGS (obj) #define GTS_OBJECT_DESTROYED (obj) #define GTS_OBJECT_SET_FLAGS (obj,flag) #define GTS_OBJECT_UNSET_FLAGS (obj,flag) GtsObject;gpointer gts_object_class_new (GtsObjectClass *parent_class, GtsObjectClassInfo *info);GtsObjectClass * gts_object_class (void);gpointer gts_object_check_cast (gpointer object,gpointer klass);gpointer gts_object_class_check_cast (gpointer klass,gpointer from);gpointer gts_object_is_from_class (gpointer object);gpointer gts_object_class_is_from_class (gpointer klass);GtsObjectClass * gts_object_class_from_name (constgchar *name); GtsObject * gts_object_new (GtsObjectClass *klass); GtsObject * gts_object_clone (GtsObject *object);void gts_object_attributes (GtsObject *object, GtsObject *from);void gts_object_init (GtsObject *object,GtsObjectClass *klass);void gts_object_reset_reserved (GtsObject *object);void gts_object_destroy (GtsObject *object);void gts_finalize (void); GtsRange;void gts_range_init (GtsRange *r);void gts_range_reset (GtsRange *r);void gts_range_add_value (GtsRange *r,gdouble val);void gts_range_update (GtsRange *r);void gts_range_print (GtsRange *r,FILE *fptr); #define GTS_IS_POINT (obj) #define GTS_POINT (obj) #define GTS_POINT_CLASS (klass) GtsPoint;GtsPointClass * gts_point_class (void); GtsPoint * gts_point_new (GtsPointClass *klass,gdouble x,gdouble y,gdouble z);void gts_point_set (GtsPoint *p,gdouble x,gdouble y,gdouble z); #define gts_point_is_in_rectangle (p, p1, p2) GtsPoint * gts_segment_triangle_intersection (GtsSegment *s, GtsTriangle *t,gboolean boundary,GtsPointClass *klass);void gts_point_transform (GtsPoint *p, GtsMatrix *m);gdouble gts_point_distance (GtsPoint *p1, GtsPoint *p2);gdouble gts_point_distance2 (GtsPoint *p1, GtsPoint *p2);gdouble gts_point_orientation_3d (GtsPoint *p1, GtsPoint *p2, GtsPoint *p3, GtsPoint *p4);gint gts_point_orientation_3d_sos (GtsPoint *p1, GtsPoint *p2, GtsPoint *p3, GtsPoint *p4); GtsIntersect gts_point_is_in_triangle (GtsPoint *p, GtsTriangle *t);gdouble gts_point_in_circle (GtsPoint *p, GtsPoint *p1, GtsPoint *p2, GtsPoint *p3);gdouble gts_point_in_sphere (GtsPoint *p, GtsPoint *p1, GtsPoint *p2, GtsPoint *p3, GtsPoint *p4);gdouble gts_point_in_triangle_circle (GtsPoint *p, GtsTriangle *t);gdouble gts_point_orientation (GtsPoint *p1, GtsPoint *p2, GtsPoint *p3);gint gts_point_orientation_sos (GtsPoint *p1, GtsPoint *p2, GtsPoint *p3);gdouble gts_point_segment_distance2 (GtsPoint *p, GtsSegment *s);gdouble gts_point_segment_distance (GtsPoint *p, GtsSegment *s);void gts_point_segment_closest (GtsPoint *p, GtsSegment *s, GtsPoint *closest);gdouble gts_point_triangle_distance2 (GtsPoint *p, GtsTriangle *t);gdouble gts_point_triangle_distance (GtsPoint *p, GtsTriangle *t);void gts_point_triangle_closest (GtsPoint *p, GtsTriangle *t, GtsPoint *closest);gboolean gts_point_is_inside_surface (GtsPoint *p,GNode *tree,gboolean is_open); #define GTS_IS_VERTEX (obj) #define GTS_VERTEX (obj) #define GTS_VERTEX_CLASS (klass) GtsVertex;GtsVertexClass * gts_vertex_class (void); GtsVertex * gts_vertex_new (GtsVertexClass *klass,gdouble x,gdouble y,gdouble z);void gts_vertex_replace (GtsVertex *v, GtsVertex *with);gboolean gts_vertex_is_unattached (GtsVertex *v); GtsSegment * gts_vertices_are_connected (GtsVertex *v1, GtsVertex *v2);GSList * gts_vertex_triangles (GtsVertex *v,GSList *list);GSList * gts_vertex_faces (GtsVertex *v, GtsSurface *surface,GSList *list);GSList * gts_vertex_neighbors (GtsVertex *v,GSList *list, GtsSurface *surface);GSList * gts_vertices_from_segments (GSList *segments);gboolean gts_vertex_is_boundary (GtsVertex *v, GtsSurface *surface);GList * gts_vertices_merge (GList *vertices,gdouble epsilon,gboolean (checkGtsVertex *, GtsVertex *) ());GSList * gts_vertex_fan_oriented (GtsVertex *v, GtsSurface *surface);guint gts_vertex_is_contact (GtsVertex *v,gboolean sever); GtsVertexNormal; #define GTS_VERTEX_NORMAL (obj) #define GTS_IS_VERTEX_NORMAL (obj)GtsVertexClass * gts_vertex_normal_class (void); GtsColorVertex; #define GTS_COLOR_VERTEX (obj) #define GTS_IS_COLOR_VERTEX (obj)GtsVertexClass * gts_color_vertex_class (void); #define GTS_IS_SEGMENT (obj) #define GTS_SEGMENT (obj) #define GTS_SEGMENT_CLASS (klass) GtsSegment;GtsSegmentClass * gts_segment_class (void); GtsSegment * gts_segment_new (GtsSegmentClass *klass, GtsVertex *v1, GtsVertex *v2); #define gts_segment_connect (s, e1, e2) #define gts_segments_are_identical (s1, s2) #define gts_segments_touch (s1, s2) GtsIntersect gts_segments_are_intersecting (GtsSegment *s1, GtsSegment *s2); GtsSegment * gts_segment_is_duplicate (GtsSegment *s); GtsVertex * gts_segment_midvertex (GtsSegment *s,GtsVertexClass *klass);GSList * gts_segments_from_vertices (GSList *vertices);gboolean gts_segment_is_ok (GtsSegment *s); #define GTS_IS_EDGE (obj) #define GTS_EDGE (obj) #define GTS_EDGE_CLASS (klass) GtsEdge;GtsEdgeClass * gts_edge_class (void); GtsEdge * gts_edge_new (GtsEdgeClass *klass, GtsVertex *v1, GtsVertex *v2); #define gts_edge_is_unattached (s) GtsFace * gts_edge_has_parent_surface (GtsEdge *e, GtsSurface *surface); GtsFace * gts_edge_has_any_parent_surface (GtsEdge *e); GtsFace * gts_edge_is_boundary (GtsEdge *e, GtsSurface *surface);void gts_edge_replace (GtsEdge *e, GtsEdge *with);GSList * gts_edges_from_vertices (GSList *vertices, GtsSurface *parent);guint gts_edge_face_number (GtsEdge *e, GtsSurface *s);gboolean gts_edge_collapse_is_valid (GtsEdge *e);gboolean gts_edge_collapse_creates_fold (GtsEdge *e, GtsVertex *v,gdouble max); GtsEdge * gts_edge_is_duplicate (GtsEdge *e);GList * gts_edges_merge (GList *edges);gboolean gts_edge_belongs_to_tetrahedron (GtsEdge *e);guint gts_edge_is_contact (GtsEdge *e);void gts_edge_swap (GtsEdge *e, GtsSurface *s);gboolean gts_edge_manifold_faces (GtsEdge *e, GtsSurface *s, GtsFace **f1, GtsFace **f2); #define GTS_IS_TRIANGLE (obj) #define GTS_TRIANGLE (obj) #define GTS_TRIANGLE_CLASS (klass) GtsTriangle;GtsTriangleClass * gts_triangle_class (void);void gts_triangle_set (GtsTriangle *triangle, GtsEdge *e1, GtsEdge *e2, GtsEdge *e3); GtsTriangle * gts_triangle_new (GtsTriangleClass *klass, GtsEdge *e1, GtsEdge *e2, GtsEdge *e3); #define gts_triangle_vertex (t) GtsVertex * gts_triangle_vertex_opposite (GtsTriangle *t, GtsEdge *e); GtsEdge * gts_triangle_edge_opposite (GtsTriangle *t, GtsVertex *v);gdouble gts_triangles_angle (GtsTriangle *t1, GtsTriangle *t2);gboolean gts_triangles_are_compatible (GtsTriangle *t1, GtsTriangle *t2, GtsEdge *e);gdouble gts_triangle_area (GtsTriangle *t);gdouble gts_triangle_perimeter (GtsTriangle *t);gdouble gts_triangle_quality (GtsTriangle *t);void gts_triangle_normal (GtsTriangle *t,gdouble *x,gdouble *y,gdouble *z);gdouble gts_triangle_orientation (GtsTriangle *t);void gts_triangle_revert (GtsTriangle *t);GSList * gts_triangles_from_edges (GSList *edges);void gts_triangle_vertices_edges (GtsTriangle *t, GtsEdge *e, GtsVertex **v1, GtsVertex **v2, GtsVertex **v3, GtsEdge **e1, GtsEdge **e2, GtsEdge **e3); GtsTriangle * gts_triangle_enclosing (GtsTriangleClass *klass,GSList *points,gdouble scale);guint gts_triangle_neighbor_number (GtsTriangle *t);GSList * gts_triangle_neighbors (GtsTriangle *t); GtsEdge * gts_triangles_common_edge (GtsTriangle *t1, GtsTriangle *t2); GtsTriangle * gts_triangle_is_duplicate (GtsTriangle *t); GtsTriangle * gts_triangle_use_edges (GtsEdge *e1, GtsEdge *e2, GtsEdge *e3);gboolean gts_triangle_is_ok (GtsTriangle *t);void gts_triangle_vertices (GtsTriangle *t, GtsVertex **v1, GtsVertex **v2, GtsVertex **v3); GtsPoint * gts_triangle_circumcircle_center (GtsTriangle *t,GtsPointClass *point_class);gboolean gts_triangles_are_folded (GSList *triangles, GtsVertex *A, GtsVertex *B,gdouble max); GtsObject * gts_triangle_is_stabbed (GtsTriangle *t, GtsPoint *p,gdouble *orientation);void gts_triangle_interpolate_height (GtsTriangle *t, GtsPoint *p); #define GTS_IS_FACE (obj) #define GTS_FACE (obj) #define GTS_FACE_CLASS (klass) GtsFace;GtsFaceClass * gts_face_class (void); GtsFace * gts_face_new (GtsFaceClass *klass, GtsEdge *e1, GtsEdge *e2, GtsEdge *e3);gboolean gts_face_has_parent_surface (GtsFace *f, GtsSurface *s);GSList * gts_faces_from_edges (GSList *edges, GtsSurface *s);guint gts_face_neighbor_number (GtsFace *f, GtsSurface *s);GSList * gts_face_neighbors (GtsFace *f, GtsSurface *s);void gts_face_foreach_neighbor (GtsFace *f, GtsSurface *s, GtsFunc func,gpointer data);gboolean gts_face_is_compatible (GtsFace *f, GtsSurface *s); #define gts_vector_cross (C,A,B) #define gts_vector_init (v, p1, p2) #define gts_vector_scalar (v1, v2) #define gts_vector_norm (v) #define gts_vector_normalize (v) GtsMatrix * gts_matrix_new (gdouble a00,gdouble a01,gdouble a02,gdouble a03,gdouble a10,gdouble a11,gdouble a12,gdouble a13,gdouble a20,gdouble a21,gdouble a22,gdouble a23,gdouble a30,gdouble a31,gdouble a32,gdouble a33);void gts_matrix_assign (GtsMatrix *m,gdouble a00,gdouble a01,gdouble a02,gdouble a03,gdouble a10,gdouble a11,gdouble a12,gdouble a13,gdouble a20,gdouble a21,gdouble a22,gdouble a23,gdouble a30,gdouble a31,gdouble a32,gdouble a33); GtsMatrix * gts_matrix_projection (GtsTriangle *t); GtsMatrix * gts_matrix_transpose (GtsMatrix *m);gdouble gts_matrix_determinant (GtsMatrix *m); GtsMatrix * gts_matrix_inverse (GtsMatrix *m); GtsMatrix * gts_matrix3_inverse (GtsMatrix *m);void gts_matrix_print (GtsMatrix *m,FILE *fptr);guint gts_matrix_compatible_row (GtsMatrix *A, GtsVector b,guint n, GtsVector A1,gdouble b1);guint gts_matrix_quadratic_optimization (GtsMatrix *A, GtsVector b,guint n, GtsMatrix *H, GtsVector c); GtsMatrix * gts_matrix_product (GtsMatrix *m1, GtsMatrix *m2); GtsMatrix * gts_matrix_zero (GtsMatrix *m); GtsMatrix * gts_matrix_identity (GtsMatrix *m); GtsMatrix * gts_matrix_scale (GtsMatrix *m, GtsVector s); GtsMatrix * gts_matrix_translate (GtsMatrix *m, GtsVector t); GtsMatrix * gts_matrix_rotate (GtsMatrix *m, GtsVector r,gdouble angle);void gts_matrix_destroy (GtsMatrix *m);void gts_vector_print (GtsVector v,FILE *fptr);void gts_vector4_print (GtsVector4 v,FILE *fptr); #define gts_kdtree_destroy (tree)GNode * gts_kdtree_new (GPtrArray *points,int (compareconst void *,const void *) ());GSList * gts_kdtree_range (GNode *tree, GtsBBox *bbox,int (compareconst void *,const void *) ());void (*GtsBBTreeTraverseFunc) (GtsBBox *bb1, GtsBBox *bb2,gpointer data);gdouble (*GtsBBoxDistFunc) (GtsPoint *p,gpointer bounded); GtsPoint * (*GtsBBoxClosestFunc) (GtsPoint *p,gpointer bounded); #define GTS_IS_BBOX (obj) #define GTS_BBOX (obj) #define GTS_BBOX_CLASS (klass) GtsBBox;GtsBBoxClass * gts_bbox_class (void); GtsBBox * gts_bbox_new (GtsBBoxClass *klass,gpointer bounded,gdouble x1,gdouble y1,gdouble z1,gdouble x2,gdouble y2,gdouble z2);void gts_bbox_set (GtsBBox *bbox,gpointer bounded,gdouble x1,gdouble y1,gdouble z1,gdouble x2,gdouble y2,gdouble z2); GtsBBox * gts_bbox_segment (GtsBBoxClass *klass, GtsSegment *s); GtsBBox * gts_bbox_triangle (GtsBBoxClass *klass, GtsTriangle *t); GtsBBox * gts_bbox_surface (GtsBBoxClass *klass, GtsSurface *surface); GtsBBox * gts_bbox_bboxes (GtsBBoxClass *klass,GSList *bboxes); GtsBBox * gts_bbox_points (GtsBBoxClass *klass,GSList *points); #define gts_bbox_point_is_inside (bbox, p)gboolean gts_bboxes_are_overlapping (GtsBBox *bb1, GtsBBox *bb2);void gts_bbox_draw (GtsBBox *bb,FILE *fptr);gdouble gts_bbox_diagonal2 (GtsBBox *bb);void gts_bbox_point_distance2 (GtsBBox *bb, GtsPoint *p,gdouble *min,gdouble *max);gboolean gts_bbox_is_stabbed (GtsBBox *bb, GtsPoint *p);gboolean gts_bbox_overlaps_triangle (GtsBBox *bb, GtsTriangle *t);gboolean gts_bbox_overlaps_segment (GtsBBox *bb, GtsSegment *s);GNode * gts_bb_tree_new (GSList *bboxes);GNode * gts_bb_tree_surface (GtsSurface *s);GSList * gts_bb_tree_stabbed (GNode *tree, GtsPoint *p);GSList * gts_bb_tree_overlap (GNode *tree, GtsBBox *bbox);gboolean gts_bb_tree_is_overlapping (GNode *tree, GtsBBox *bbox);void gts_bb_tree_traverse_overlapping (GNode *tree1,GNode *tree2, GtsBBTreeTraverseFunc func,gpointer data);void gts_bb_tree_draw (GNode *tree,guint depth,FILE *fptr);GSList * gts_bb_tree_point_closest_bboxes (GNode *tree, GtsPoint *p);gdouble gts_bb_tree_point_distance (GNode *tree, GtsPoint *p, GtsBBoxDistFunc distance, GtsBBox **bbox); GtsPoint * gts_bb_tree_point_closest (GNode *tree, GtsPoint *p, GtsBBoxClosestFunc closest,gdouble *distance);void gts_bb_tree_segment_distance (GNode *tree, GtsSegment *s, GtsBBoxDistFunc distance,gdouble delta, GtsRange *range);void gts_bb_tree_triangle_distance (GNode *tree, GtsTriangle *t, GtsBBoxDistFunc distance,gdouble delta, GtsRange *range);void gts_bb_tree_surface_distance (GNode *tree, GtsSurface *s, GtsBBoxDistFunc distance,gdouble delta, GtsRange *range);void gts_bb_tree_surface_boundary_distance (GNode *tree, GtsSurface *s, GtsBBoxDistFunc distance,gdouble delta, GtsRange *range);void gts_bb_tree_destroy (GNode *tree,gboolean free_leaves); GtsSurfaceStats; GtsSurfaceQualityStats; GtsVertex * (*GtsRefineFunc) (GtsEdge *e,GtsVertexClass *klass,gpointer data); GtsVertex * (*GtsCoarsenFunc) (GtsEdge *e,GtsVertexClass *klass,gpointer data);gboolean (*GtsStopFunc) (gdouble cost,guint nedge,gpointer data); GtsSurface; #define GTS_IS_SURFACE (obj) #define GTS_SURFACE (obj) #define GTS_SURFACE_CLASS (klass)GtsSurfaceClass * gts_surface_class (void); GtsSurface * gts_surface_new (GtsSurfaceClass *klass,GtsFaceClass *face_class,GtsEdgeClass *edge_class,GtsVertexClass *vertex_class);void gts_surface_add_face (GtsSurface *s, GtsFace *f);void gts_surface_remove_face (GtsSurface *s, GtsFace *f);guint gts_surface_read (GtsSurface *surface, GtsFile *f);gdouble gts_surface_area (GtsSurface *s);void gts_surface_stats (GtsSurface *s, GtsSurfaceStats *stats);void gts_surface_quality_stats (GtsSurface *s, GtsSurfaceQualityStats *stats);void gts_surface_print_stats (GtsSurface *s,FILE *fptr);void gts_surface_write (GtsSurface *s,FILE *fptr);void gts_surface_write_oogl (GtsSurface *s,FILE *fptr);void gts_surface_write_vtk (GtsSurface *s,FILE *fptr);void gts_surface_write_oogl_boundary (GtsSurface *s,FILE *fptr);void gts_surface_foreach_vertex (GtsSurface *s, GtsFunc func,gpointer data);void gts_surface_foreach_edge (GtsSurface *s, GtsFunc func,gpointer data);void gts_surface_foreach_face (GtsSurface *s, GtsFunc func,gpointer data);guint gts_surface_foreach_face_remove (GtsSurface *s, GtsFunc func,gpointer data); GtsSurfaceTraverse; GtsSurfaceTraverse * gts_surface_traverse_new (GtsSurface *s, GtsFace *f); GtsFace * gts_surface_traverse_next (GtsSurfaceTraverse *t,guint *level);void gts_surface_traverse_destroy (GtsSurfaceTraverse *t);void gts_surface_refine (GtsSurface *surface, GtsKeyFunc cost_func,gpointer cost_data, GtsRefineFunc refine_func,gpointer refine_data, GtsStopFunc stop_func,gpointer stop_data);void gts_surface_coarsen (GtsSurface *surface, GtsKeyFunc cost_func,gpointer cost_data, GtsCoarsenFunc coarsen_func,gpointer coarsen_data, GtsStopFunc stop_func,gpointer stop_data,gdouble minangle);gboolean gts_coarsen_stop_number (gdouble cost,guint nedge,guint *min_number);gboolean gts_coarsen_stop_cost (gdouble cost,guint nedge,gdouble *max_cost);void gts_surface_tessellate (GtsSurface *s, GtsRefineFunc refine_func,gpointer refine_data); GtsSurface * gts_surface_generate_sphere (GtsSurface *s,guint geodesation_order); GtsSurface * gts_surface_copy (GtsSurface *s1, GtsSurface *s2);void gts_surface_merge (GtsSurface *s, GtsSurface *with);gboolean gts_surface_is_manifold (GtsSurface *s);gboolean gts_surface_is_closed (GtsSurface *s);gboolean gts_surface_is_orientable (GtsSurface *s);gdouble gts_surface_volume (GtsSurface *s);gdouble gts_surface_center_of_mass (GtsSurface *s, GtsVector cm);gdouble gts_surface_center_of_area (GtsSurface *s, GtsVector cm);guint gts_surface_vertex_number (GtsSurface *s);guint gts_surface_edge_number (GtsSurface *s);guint gts_surface_face_number (GtsSurface *s);void gts_surface_distance (GtsSurface *s1, GtsSurface *s2,gdouble delta, GtsRange *face_range, GtsRange *boundary_range);GSList * gts_surface_boundary (GtsSurface *surface);GSList * gts_surface_split (GtsSurface *s);gboolean gts_vertex_mean_curvature_normal (GtsVertex *v, GtsSurface *s, GtsVector Kh);gboolean gts_vertex_gaussian_curvature (GtsVertex *v, GtsSurface *s,gdouble *Kg);void gts_vertex_principal_curvatures (gdouble Kh,gdouble Kg,gdouble *K1,gdouble *K2);void gts_vertex_principal_directions (GtsVertex *v, GtsSurface *s, GtsVector Kh,gdouble Kg, GtsVector e1, GtsVector e2); GtsVolumeOptimizedParams; GtsVertex * gts_volume_optimized_vertex (GtsEdge *edge,GtsVertexClass *klass, GtsVolumeOptimizedParams *params);gdouble gts_volume_optimized_cost (GtsEdge *e, GtsVolumeOptimizedParams *params);GSList * gts_surface_intersection (GtsSurface *s1, GtsSurface *s2,GNode *faces_tree1,GNode *faces_tree2); enum GtsBooleanOperation; #define GTS_IS_SURFACE_INTER (obj) #define GTS_SURFACE_INTER (obj) #define GTS_SURFACE_INTER_CLASS (klass) GtsSurfaceInter;GtsSurfaceInterClass * gts_surface_inter_class (void); GtsSurfaceInter * gts_surface_inter_new (GtsSurfaceInterClass *klass, GtsSurface *s1, GtsSurface *s2,GNode *faces_tree1,GNode *faces_tree2,gboolean is_open1,gboolean is_open2);gboolean gts_surface_inter_check (GtsSurfaceInter *si,gboolean *closed);void gts_surface_inter_boolean (GtsSurfaceInter *si, GtsSurface *surface, GtsBooleanOperation op);gboolean gts_surface_foreach_intersecting_face (GtsSurface *s, GtsBBTreeTraverseFunc func,gpointer data); GtsSurface * gts_surface_is_self_intersecting (GtsSurface *s); GtsHeap; GtsHeap * gts_heap_new (GCompareFunc compare_func);void gts_heap_insert (GtsHeap *heap,gpointer p);gpointer gts_heap_remove_top (GtsHeap *heap);gpointer gts_heap_top (GtsHeap *heap);void gts_heap_thaw (GtsHeap *heap);void gts_heap_foreach (GtsHeap *heap,GFunc func,gpointer user_data);void gts_heap_freeze (GtsHeap *heap);guint gts_heap_size (GtsHeap *heap);void gts_heap_destroy (GtsHeap *heap); GtsEHeap; GtsEHeapPair; GtsEHeap * gts_eheap_new (GtsKeyFunc key_func,gpointer data); GtsEHeapPair * gts_eheap_insert (GtsEHeap *heap,gpointer p); GtsEHeapPair * gts_eheap_insert_with_key (GtsEHeap *heap,gpointer p,gdouble key);gpointer gts_eheap_remove_top (GtsEHeap *heap,gdouble *key);gpointer gts_eheap_top (GtsEHeap *heap,gdouble *key);void gts_eheap_thaw (GtsEHeap *heap);void gts_eheap_foreach (GtsEHeap *heap,GFunc func,gpointer data);gpointer gts_eheap_remove (GtsEHeap *heap, GtsEHeapPair *p);void gts_eheap_decrease_key (GtsEHeap *heap, GtsEHeapPair *p,gdouble new_key);void gts_eheap_freeze (GtsEHeap *heap);guint gts_eheap_size (GtsEHeap *heap);void gts_eheap_update (GtsEHeap *heap);gdouble gts_eheap_key (GtsEHeap *heap,gpointer p);void gts_eheap_randomized (GtsEHeap *heap,gboolean randomized);void gts_eheap_destroy (GtsEHeap *heap); GtsFifo; GtsFifo * gts_fifo_new (void);void gts_fifo_write (GtsFifo *fifo,FILE *fp);void gts_fifo_push (GtsFifo *fifo,gpointer data);gpointer gts_fifo_pop (GtsFifo *fifo);gpointer gts_fifo_top (GtsFifo *fifo);guint gts_fifo_size (GtsFifo *fifo);gboolean gts_fifo_is_empty (GtsFifo *fifo);void gts_fifo_foreach (GtsFifo *fifo, GtsFunc func,gpointer data);void gts_fifo_reverse (GtsFifo *fifo);void gts_fifo_destroy (GtsFifo *fifo); GtsSplitCFace; GtsSplit; #define GTS_IS_SPLIT (obj) #define GTS_SPLIT (obj) #define GTS_SPLIT_CLASS (klass) #define GTS_SPLIT_V1 (vs) #define GTS_SPLIT_V2 (vs)GtsSplitClass * gts_split_class (void); GtsSplit * gts_split_new (GtsSplitClass *klass, GtsVertex *v, GtsObject *o1, GtsObject *o2);void gts_split_collapse (GtsSplit *vs,GtsEdgeClass *klass, GtsEHeap *heap);void gts_split_expand (GtsSplit *vs, GtsSurface *s,GtsEdgeClass *klass);gboolean (*GtsSplitTraverseFunc) (GtsSplit *vs,gpointer data);void gts_split_traverse (GtsSplit *root,GTraverseType order,gint depth, GtsSplitTraverseFunc func,gpointer data);guint gts_split_height (GtsSplit *root); GtsPSurface; #define GTS_IS_PSURFACE (obj) #define GTS_PSURFACE (obj) #define GTS_PSURFACE_CLASS (klass) #define GTS_PSURFACE_IS_CLOSED (ps)GtsPSurfaceClass * gts_psurface_class (void); GtsPSurface * gts_psurface_new (GtsPSurfaceClass *klass, GtsSurface *surface,GtsSplitClass *split_class, GtsKeyFunc cost_func,gpointer cost_data, GtsCoarsenFunc coarsen_func,gpointer coarsen_data, GtsStopFunc stop_func,gpointer stop_data,gdouble minangle); GtsSplit * gts_psurface_add_vertex (GtsPSurface *ps); GtsSplit * gts_psurface_remove_vertex (GtsPSurface *ps);guint gts_psurface_max_vertex_number (GtsPSurface *ps);guint gts_psurface_min_vertex_number (GtsPSurface *ps);void gts_psurface_set_vertex_number (GtsPSurface *ps,guint n);guint gts_psurface_get_vertex_number (GtsPSurface *ps);void gts_psurface_write (GtsPSurface *ps,FILE *fptr); GtsPSurface * gts_psurface_open (GtsPSurfaceClass *klass, GtsSurface *s,GtsSplitClass *split_class, GtsFile *f); GtsSplit * gts_psurface_read_vertex (GtsPSurface *ps, GtsFile *fp);void gts_psurface_close (GtsPSurface *ps);void gts_psurface_foreach_vertex (GtsPSurface *ps, GtsFunc func,gpointer data); GtsHSplit; #define GTS_IS_HSPLIT (obj) #define GTS_HSPLIT (obj) #define GTS_HSPLIT_CLASS (klass)GtsHSplitClass * gts_hsplit_class (void); GtsHSplit * gts_hsplit_new (GtsHSplitClass *klass, GtsSplit *vs);void gts_hsplit_collapse (GtsHSplit *hs, GtsHSurface *hsurface);void gts_hsplit_expand (GtsHSplit *hs, GtsHSurface *hsurface);void gts_hsplit_force_expand (GtsHSplit *hs, GtsHSurface *hsurface); GtsHSurface; #define GTS_IS_HSURFACE (obj) #define GTS_HSURFACE (obj) #define GTS_HSURFACE_CLASS (klass)GtsHSurfaceClass * gts_hsurface_class (void); GtsHSurface * gts_hsurface_new (GtsHSurfaceClass *klass,GtsHSplitClass *hsplit_class, GtsPSurface *psurface, GtsKeyFunc expand_key,gpointer expand_data, GtsKeyFunc collapse_key,gpointer collapse_data);void gts_hsurface_traverse (GtsHSurface *hsurface,GTraverseType order,gint depth, GtsSplitTraverseFunc func,gpointer data);void gts_hsurface_foreach (GtsHSurface *hsurface,GTraverseType order, GtsFunc func,gpointer data);guint gts_hsurface_height (GtsHSurface *hsurface); #define GTS_IS_CONSTRAINT (obj) #define GTS_CONSTRAINT (obj) #define GTS_CONSTRAINT_CLASS (klass) GtsConstraint; GtsConstraintClass; GtsConstraintClass * gts_constraint_class (void); GtsFace * gts_point_locate (GtsPoint *p, GtsSurface *surface, GtsFace *guess); GtsVertex * gts_delaunay_add_vertex_to_face (GtsSurface *surface, GtsVertex *v, GtsFace *f); GtsVertex * gts_delaunay_add_vertex (GtsSurface *surface, GtsVertex *v, GtsFace *guess);void gts_delaunay_remove_vertex (GtsSurface *surface, GtsVertex *v); GtsFace * gts_delaunay_check (GtsSurface *surface);GSList * gts_delaunay_add_constraint (GtsSurface *surface, GtsConstraint *c);void gts_delaunay_remove_hull (GtsSurface *surface); GtsListFace; #define GTS_LIST_FACE (obj) #define GTS_IS_LIST_FACE (obj)GtsFaceClass * gts_list_face_class (void);gboolean (*GtsEncroachFunc) (GtsVertex *v, GtsEdge *e, GtsSurface *s,gpointer data);gboolean gts_vertex_encroaches_edge (GtsVertex *v, GtsEdge *e); GtsVertex * gts_edge_is_encroached (GtsEdge *e, GtsSurface *s, GtsEncroachFunc encroaches,gpointer data);guint gts_delaunay_conform (GtsSurface *surface,gint steiner_max, GtsEncroachFunc encroaches,gpointer data);guint gts_delaunay_refine (GtsSurface *surface,gint steiner_max, GtsEncroachFunc encroaches,gpointer encroach_data, GtsKeyFunc cost,gpointer cost_data); GtsGridPlane; GtsIsoSlice; GtsCartesianGrid;void (*GtsIsoCartesianFunc) (gdouble **a, GtsCartesianGrid g,guint i,gpointer data); GtsGridPlane * gts_grid_plane_new (guint nx,guint ny);void gts_grid_plane_destroy (GtsGridPlane *g); GtsIsoSlice * gts_iso_slice_new (guint nx,guint ny);void gts_iso_slice_fill (GtsIsoSlice *slice, GtsGridPlane *plane1, GtsGridPlane *plane2,gdouble **f1,gdouble **f2,gdouble iso,GtsVertexClass *klass);void gts_iso_slice_fill_cartesian (GtsIsoSlice *slice, GtsCartesianGrid g,gdouble **f1,gdouble **f2,gdouble iso,GtsVertexClass *klass);void gts_iso_slice_destroy (GtsIsoSlice *slice);void gts_isosurface_slice (GtsIsoSlice *slice1, GtsIsoSlice *slice2, GtsSurface *surface);void gts_isosurface_cartesian (GtsSurface *surface, GtsCartesianGrid g, GtsIsoCartesianFunc f,gpointer data,gdouble iso);void gts_isosurface_tetra (GtsSurface *surface, GtsCartesianGrid g, GtsIsoCartesianFunc f,gpointer data,gdouble iso);void gts_isosurface_tetra_bcl (GtsSurface *surface, GtsCartesianGrid g, GtsIsoCartesianFunc f,gpointer data,gdouble iso);void gts_isosurface_tetra_bounded (GtsSurface *surface, GtsCartesianGrid g, GtsIsoCartesianFunc f,gpointer data,gdouble iso); #define GTS_NAME_LENGTH #define GTS_NVERTEX (obj) #define GTS_NVERTEX_CLASS (klass) #define GTS_IS_NVERTEX (obj) GtsNVertex;GtsNVertexClass * gts_nvertex_class (void); #define GTS_NEDGE (obj) #define GTS_NEDGE_CLASS (klass) #define GTS_IS_NEDGE (obj) GtsNEdge;GtsNEdgeClass * gts_nedge_class (void); #define GTS_NFACE (obj) #define GTS_NFACE_CLASS (klass) #define GTS_IS_NFACE (obj) GtsNFace;GtsNFaceClass * gts_nface_class (void); #define GTS_CLUSTER (obj) #define GTS_CLUSTER_CLASS (klass) #define GTS_IS_CLUSTER (obj) GtsClusterId; GtsCluster;GtsClusterClass * gts_cluster_class (void); GtsCluster * gts_cluster_new (GtsClusterClass *klass, GtsClusterId id,GtsVertexClass *vklass);void gts_cluster_add (GtsCluster *c, GtsPoint *p,gpointer data);void gts_cluster_update (GtsCluster *c); #define GTS_CLUSTER_GRID (obj) #define GTS_CLUSTER_GRID_CLASS (klass) #define GTS_IS_CLUSTER_GRID (obj) GtsClusterGrid;GtsClusterGridClass * gts_cluster_grid_class (void); GtsClusterGrid * gts_cluster_grid_new (GtsClusterGridClass *klass,GtsClusterClass *cluster_class, GtsSurface *s, GtsBBox *bbox,gdouble delta);void gts_cluster_grid_add_triangle (GtsClusterGrid *cluster_grid, GtsPoint *p1, GtsPoint *p2, GtsPoint *p3,gpointer data); GtsRange gts_cluster_grid_update (GtsClusterGrid *cluster_grid);GSList * gts_surface_strip (GtsSurface *s); GtsContainee; #define GTS_CONTAINEE (obj) #define GTS_CONTAINEE_CLASS (klass) #define GTS_IS_CONTAINEE (obj)GtsContaineeClass * gts_containee_class (void); GtsContainee * gts_containee_new (GtsContaineeClass *klass);gboolean gts_containee_is_contained (GtsContainee *item, GtsContainer *c);void gts_containee_replace (GtsContainee *item, GtsContainee *with); GtsSListContainee; #define GTS_SLIST_CONTAINEE (obj) #define GTS_SLIST_CONTAINEE_CLASS (klass) #define GTS_IS_SLIST_CONTAINEE (obj)GtsSListContaineeClass * gts_slist_containee_class (void); GtsContainer; #define GTS_CONTAINER (obj) #define GTS_CONTAINER_CLASS (klass) #define GTS_IS_CONTAINER (obj)GtsContainerClass * gts_container_class (void); GtsContainer * gts_container_new (GtsContainerClass *klass);void gts_container_add (GtsContainer *c, GtsContainee *item);void gts_container_remove (GtsContainer *c, GtsContainee *item);void gts_container_foreach (GtsContainer *c, GtsFunc func,gpointer data);guint gts_container_size (GtsContainer *c); GtsHashContainer; #define GTS_HASH_CONTAINER (obj) #define GTS_HASH_CONTAINER_CLASS (klass) #define GTS_IS_HASH_CONTAINER (obj)GtsHashContainerClass * gts_hash_container_class (void); GtsSListContainer; #define GTS_SLIST_CONTAINER (obj) #define GTS_SLIST_CONTAINER_CLASS (klass) #define GTS_IS_SLIST_CONTAINER (obj)GtsSListContainerClass * gts_slist_container_class (void); GtsGNode; #define GTS_GNODE (obj) #define GTS_GNODE_CLASS (klass) #define GTS_IS_GNODE (obj) #define GTS_GNODE_NEIGHBOR (n,e)GtsGNodeClass * gts_gnode_class (void); GtsGNode * gts_gnode_new (GtsGNodeClass *klass);void gts_gnode_foreach_neighbor (GtsGNode *n, GtsGraph *g, GtsFunc func,gpointer data);void gts_gnode_foreach_edge (GtsGNode *n, GtsGraph *g, GtsFunc func,gpointer data);guint gts_gnode_degree (GtsGNode *n, GtsGraph *g);gfloat gts_gnode_move_cost (GtsGNode *n, GtsGraph *src, GtsGraph *dst);gfloat gts_gnode_weight (GtsGNode *n); GtsNGNode; #define GTS_NGNODE (obj) #define GTS_NGNODE_CLASS (klass) #define GTS_IS_NGNODE (obj)GtsNGNodeClass * gts_ngnode_class (void); GtsNGNode * gts_ngnode_new (GtsNGNodeClass *klass,guint id); GtsWGNode; #define GTS_WGNODE (obj) #define GTS_WGNODE_CLASS (klass) #define GTS_IS_WGNODE (obj)GtsWGNodeClass * gts_wgnode_class (void); GtsWGNode * gts_wgnode_new (GtsWGNodeClass *klass,gfloat weight); GtsPNode; #define GTS_PNODE (obj) #define GTS_PNODE_CLASS (klass) #define GTS_IS_PNODE (obj)GtsPNodeClass * gts_pnode_class (void); GtsPNode * gts_pnode_new (GtsPNodeClass *klass,gpointer data); GtsFNode; #define GTS_FNODE (obj) #define GTS_FNODE_CLASS (klass) #define GTS_IS_FNODE (obj)GtsFNodeClass * gts_fnode_class (void); GtsFNode * gts_fnode_new (GtsFNodeClass *klass, GtsFace *f); GtsGEdge; #define GTS_GEDGE (obj) #define GTS_GEDGE_CLASS (klass) #define GTS_IS_GEDGE (obj)GtsGEdgeClass * gts_gedge_class (void); GtsGEdge * gts_gedge_new (GtsGEdgeClass *klass, GtsGNode *n1, GtsGNode *n2);gfloat gts_gedge_weight (GtsGEdge *e); #define gts_gedge_connects (e, a1, a2) GtsPGEdge; #define GTS_PGEDGE (obj) #define GTS_PGEDGE_CLASS (klass) #define GTS_IS_PGEDGE (obj)GtsPGEdgeClass * gts_pgedge_class (void); GtsPGEdge * gts_pgedge_new (GtsPGEdgeClass *klass, GtsGNode *n1, GtsGNode *n2,gpointer data); GtsWGEdge; #define GTS_WGEDGE (obj) #define GTS_WGEDGE_CLASS (klass) #define GTS_IS_WGEDGE (obj)GtsWGEdgeClass * gts_wgedge_class (void); GtsWGEdge * gts_wgedge_new (GtsWGEdgeClass *klass, GtsGNode *n1, GtsGNode *n2,gfloat weight); GtsGraph; #define GTS_GRAPH (obj) #define GTS_GRAPH_CLASS (klass) #define GTS_IS_GRAPH (obj)GtsGraphClass * gts_graph_class (void); GtsGraph * gts_graph_new (GtsGraphClass *klass,GtsGNodeClass *node_class,GtsGEdgeClass *edge_class);void gts_graph_print_stats (GtsGraph *g,FILE *fp); GtsGraphTraverse; enum GtsTraverseType; GtsGraphTraverse * gts_graph_traverse_new (GtsGraph *g, GtsGNode *n, GtsTraverseType type,gboolean reinit); GtsGNode * gts_graph_traverse_next (GtsGraphTraverse *t); GtsGNode * gts_graph_traverse_what_next (GtsGraphTraverse *t);void gts_graph_traverse_destroy (GtsGraphTraverse *t);void gts_graph_foreach_edge (GtsGraph *g, GtsFunc func,gpointer data);gfloat gts_graph_weight (GtsGraph *g);guint gts_graph_distance_sum (GtsGraph *g, GtsGNode *center); GtsGNode * gts_graph_farthest (GtsGraph *g,GSList *gnodes);guint gts_graph_edges_cut (GtsGraph *g);gfloat gts_graph_edges_cut_weight (GtsGraph *g);void gts_graph_write (GtsGraph *g,FILE *fp);void gts_graph_write_dot (GtsGraph *g,FILE *fp); GtsGraph * gts_graph_read (GtsFile *fp);guint gts_graph_read_jostle (GtsGraph *g, GtsFile *fp); GtsWGraph; #define GTS_WGRAPH (obj) #define GTS_WGRAPH_CLASS (klass) #define GTS_IS_WGRAPH (obj)GtsWGraphClass * gts_wgraph_class (void);gfloat gts_wgraph_weight_max (GtsWGraph *wg); GtsGraph * gts_surface_graph_new (GtsGraphClass *klass, GtsSurface *s); GtsSurface * gts_surface_graph_surface (GtsGraph *surface_graph, GtsSurface *s); GtsGraph * gts_segments_graph_new (GtsGraphClass *klass,GSList *segments); GtsGNodeSplit; #define GTS_GNODE_SPLIT (obj) #define GTS_GNODE_SPLIT_CLASS (klass) #define GTS_IS_GNODE_SPLIT (obj) #define GTS_GNODE_SPLIT_N1 (ns) #define GTS_GNODE_SPLIT_N2 (ns)GtsGNodeSplitClass * gts_gnode_split_class (void); GtsGNodeSplit * gts_gnode_split_new (GtsGNodeSplitClass *klass, GtsGNode *n, GtsObject *n1, GtsObject *n2);void gts_gnode_split_collapse (GtsGNodeSplit *ns, GtsGraph *g,GtsWGEdgeClass *klass);void gts_gnode_split_expand (GtsGNodeSplit *ns, GtsGraph *g); GtsPGraph; #define GTS_PGRAPH (obj) #define GTS_PGRAPH_CLASS (klass) #define GTS_IS_PGRAPH (obj)GtsPGraphClass * gts_pgraph_class (void); GtsPGraph * gts_pgraph_new (GtsPGraphClass *klass, GtsGraph *g,GtsGNodeSplitClass *split_class,GtsWGNodeClass *node_class,GtsWGEdgeClass *edge_class,guint min); GtsGNodeSplit * gts_pgraph_add_node (GtsPGraph *pg); GtsGNodeSplit * gts_pgraph_remove_node (GtsPGraph *pg);void gts_pgraph_set_node_number (GtsPGraph *pg,guint n);guint gts_pgraph_get_node_number (GtsPGraph *pg);guint gts_pgraph_min_node_number (GtsPGraph *pg);guint gts_pgraph_max_node_number (GtsPGraph *pg);void gts_pgraph_foreach_node (GtsPGraph *pg, GtsFunc func,gpointer data);gboolean gts_pgraph_down (GtsPGraph *pg, GtsFunc func,gpointer data);GSList * gts_graph_bubble_partition (GtsGraph *g,guint np,guint niter, GtsFunc step_info,gpointer data);guint gts_graph_partition_edges_cut (GSList *partition);gfloat gts_graph_partition_edges_cut_weight (GSList *partition);void gts_graph_partition_print_stats (GSList *partition,FILE *fp);gfloat gts_graph_partition_balance (GSList *partition);GSList * gts_graph_partition_clone (GSList *partition);GSList * gts_graph_recursive_bisection (GtsWGraph *wg,guint n,guint ntry,guint mmax,guint nmin,gfloat imbalance);void gts_graph_partition_destroy (GSList *partition); GtsGraphBisection;gboolean gts_graph_bisection_check (GtsGraphBisection *bg); GtsGraphBisection * gts_graph_ggg_bisection (GtsGraph *g,guint ntry); GtsGraphBisection * gts_graph_bfgg_bisection (GtsGraph *g,guint ntry);gdouble gts_graph_bisection_kl_refine (GtsGraphBisection *bg,guint mmax);gdouble gts_graph_bisection_bkl_refine (GtsGraphBisection *bg,guint mmax,gfloat imbalance); GtsGraphBisection * gts_graph_bisection_new (GtsWGraph *wg,guint ntry,guint mmax,guint nmin,gfloat imbalance);void gts_graph_bisection_destroy (GtsGraphBisection *bg,gboolean destroy_graphs);
typedef struct { gchar name[GTS_CLASS_NAME_LENGTH]; guint object_size; guint class_size; GtsObjectClassInitFunc class_init_func; GtsObjectInitFunc object_init_func; GtsArgSetFunc arg_set_func; GtsArgGetFunc arg_get_func; } GtsObjectClassInfo;
gdouble (*GtsKeyFunc) (gpointer item,gpointer data);
item : | A pointer to an item to be stored in the heap. |
data : | User data passed to |
Returns : | the value of the key for the given item. |
typedef struct { FILE * fp; guint line, pos; GString * token; GtsTokenType type; gchar * error; guint curline, curpos; guint scope, scope_max; gint next_token; gchar * delimiters; gchar * comments; gchar * tokens; gchar * buf; size_t len; } GtsFile;
typedef enum { GTS_NONE = 1 << 8, GTS_INT = 1 << 9, GTS_UINT = 1 << 10, GTS_FLOAT = 1 << 11, GTS_DOUBLE = 1 << 12, GTS_STRING = 1 << 13, GTS_FILE = 1 << 14, GTS_ERROR = 1 << 15, GTS_OBJ = 1 << 16, } GtsTokenType;
typedef struct { GtsTokenType type; gchar name[30]; gboolean unique; gpointer data; gboolean set; guint line, pos; } GtsFileVariable;
GtsFile * gts_file_new_from_string (gchar *s);
s : | a string. |
Returns : | a new GtsFile. |
GtsFile * gts_file_new_from_buffer (gchar *buf,size_t len);
buf : | a buffer. |
len : | the size of the buffer. |
Returns : | a new GtsFile. |
void gts_file_verror (GtsFile *f, constgchar *format,va_list args);
Sets the error
field of f
using g_strdup_vprintf()
This function can be called only once and disables any other
operation on f
(gts_file_close()
f : | a |
format : | the standard |
args : | the list of parameters to insert into the format string. |
void gts_file_error (GtsFile *f, constgchar *format, ...);
Sets the error
field of f
using gts_file_verror()
.
This function can be called only once and disables any other
operation on f
(gts_file_close()
f : | a |
format : | the standard |
... : | the parameters to insert into the format string. |
gint gts_file_getc (GtsFile *f);
f : | a GtsFile. |
Returns : | the next character in |
guint gts_file_read (GtsFile *f,gpointer ptr,guint size,guint nmemb);
Reads nmemb
elements of data, each size
bytes long, from f
,
storing them at the location given by ptr
.
f : | a GtsFile. |
ptr : | a pointer. |
size : | size of an element. |
nmemb : | number of elements. |
Returns : | the number of elements read. |
gint gts_file_getc_scope (GtsFile *f);
f : | a GtsFile. |
Returns : | the next character in |
void gts_file_next_token (GtsFile *f);
Reads next token from f
and updates its token
and delim
fields.
f : | a GtsFile. |
void gts_file_first_token_after (GtsFile *f, GtsTokenType type);
Finds and sets the first token of a type different from type
occuring after a token of type type
.
f : | a GtsFile. |
type : | a GtsTokenType. |
void gts_file_assign_start (GtsFile *f, GtsFileVariable *vars);
Opens a block delimited by braces to read a list of optional
arguments specified by vars
.
If an error is encountered the error
field of f
is set.
f : | a GtsFile. |
vars : | a |
GtsFileVariable * gts_file_assign_next (GtsFile *f, GtsFileVariable *vars);
Assigns the next optional argument of vars
read from f
.
f : | a GtsFile. |
vars : | a |
Returns : | the variable of |
void gts_file_assign_variables (GtsFile *f, GtsFileVariable *vars);
Assigns all the variables belonging to vars
found in f
.
If an error is encountered the error
field of f
is set.
f : | a GtsFile. |
vars : | an array of GtsFileVariable. |
void gts_file_variable_error (GtsFile *f, GtsFileVariable *vars, constgchar *name, constgchar *format, ...);
Sets the error
field of f
using gts_file_verror()
.
String name
must match one of the variable names in vars
.
If variable name
has been assigned (using gts_file_assign_variables()
)
sets the line
and pos
fields of f
to the line and position where
it has been assigned.
f : | a GtsFile. |
vars : | an array of GtsFileVariable. |
name : | the name of a variable in |
format : | the standard |
... : | the parameters to insert into the format string. |
void gts_file_destroy (GtsFile *f);
Frees all the memory allocated for f
.
f : | a GtsFile. |
typedef enum { GTS_DESTROYED = 1 << 0, GTS_USER_FLAG = 1 /* user flags start from here */ } GtsObjectFlags;
#define GTS_OBJECT_DESTROYED(obj) ((GTS_OBJECT_FLAGS (obj) & GTS_DESTROYED) != 0)
obj : |
#define GTS_OBJECT_SET_FLAGS(obj,flag) G_STMT_START{ (GTS_OBJECT_FLAGS (obj) |= (flag)); }G_STMT_END
obj : | |
flag : |
#define GTS_OBJECT_UNSET_FLAGS(obj,flag) G_STMT_START{ (GTS_OBJECT_FLAGS (obj) &= ~(flag)); }G_STMT_END
obj : | |
flag : |
gpointer gts_object_class_new (GtsObjectClass *parent_class, GtsObjectClassInfo *info);
parent_class : | a |
info : | a GtsObjectClassInfo, description of the new class to create. |
Returns : | a new |
gpointer gts_object_check_cast (gpointer object,gpointer klass);
object : | a GtsObject. |
klass : | a |
Returns : | |
gpointer gts_object_class_check_cast (gpointer klass,gpointer from);
klass : | a |
from : | a |
Returns : | |
gpointer gts_object_class_is_from_class (gpointer klass);
klass : | |
Returns : |
GtsObjectClass * gts_object_class_from_name (constgchar *name);
name : | the name of a |
Returns : | the |
GtsObject * gts_object_new (GtsObjectClass *klass);
klass : | a |
Returns : | a new initialized object of class |
GtsObject * gts_object_clone (GtsObject *object);
Calls the clone method of object
. The call to this function will fail
if no clone method exists for the given object.
object : | a GtsObject. |
Returns : | a new object clone of |
void gts_object_attributes (GtsObject *object, GtsObject *from);
Calls the attributes()
object
using from
as source.
object : | a GtsObject. |
from : | a GtsObject. |
void gts_object_init (GtsObject *object,GtsObjectClass *klass);
Calls the init method of klass
with object
as argument. This is done
recursively in the correct order (from the base class to the top). You
should rarely need this function as it is called automatically by the
constructor for each class.
object : | a GtsObject. |
klass : | a |
void gts_object_reset_reserved (GtsObject *object);
Reset the reserved field of object
.
object : | a GtsObject. |
void gts_object_destroy (GtsObject *object);
Calls the destroy method of object
, freeing all memory allocated for it.
object : | a GtsObject. |
void gts_finalize (void);
Free all the memory allocated by the object system of GTS. No other GTS function can be called after this function has been called.
void gts_range_add_value (GtsRange *r,gdouble val);
Adds val
to r
.
r : | a GtsRange. |
val : | a value to add to |
void gts_range_print (GtsRange *r,FILE *fptr);
Writes a text representation of r
in fptr
.
r : | a GtsRange. |
fptr : | a file pointer. |
typedef struct { GtsObject object; gdouble x, y, z; /* must be contiguous (cast to robust functions) */ } GtsPoint;
GtsPoint * gts_point_new (GtsPointClass *klass,gdouble x,gdouble y,gdouble z);
klass : | a |
x : | the x-coordinate. |
y : | the y-coordinate. |
z : | the z-coordinate. |
Returns : | a new GtsPoint. |
void gts_point_set (GtsPoint *p,gdouble x,gdouble y,gdouble z);
Sets the coordinates of p
.
p : | a GtsPoint. |
x : | the x-coordinate. |
y : | the y-coordinate. |
z : | the z-coordinate. |
GtsPoint * gts_segment_triangle_intersection (GtsSegment *s, GtsTriangle *t,gboolean boundary,GtsPointClass *klass);
Checks if s
intersects t
. If this is the case, creates a new
point pi intersection of s
with t
.
This function is geometrically robust in the sense that it will not
return a point if s
and t
do not intersect and will return a
point if s
and t
do intersect. However, the point coordinates are
subject to round-off errors.
Note that this function will not return any point if s
is contained in
the plane defined by t
.
s : | a GtsSegment. |
t : | a GtsTriangle. |
boundary : | if |
klass : | a |
Returns : | a summit of |
void gts_point_transform (GtsPoint *p, GtsMatrix *m);
Transform the coordinates of p
according to m
. (p[] becomes m[][].p[]).
p : | a GtsPoint. |
m : | the GtsMatrix representing the transformation to
apply to the coordinates of |
gdouble gts_point_distance (GtsPoint *p1, GtsPoint *p2);
p1 : | a GtsPoint. |
p2 : | another GtsPoint. |
Returns : | the Euclidean distance between |
gdouble gts_point_distance2 (GtsPoint *p1, GtsPoint *p2);
p1 : | a GtsPoint. |
p2 : | another GtsPoint. |
Returns : | the square of the Euclidean distance between |
gdouble gts_point_orientation_3d (GtsPoint *p1, GtsPoint *p2, GtsPoint *p3, GtsPoint *p4);
Checks if p4
lies above, below or on the plane passing through the
points p1
, p2
and p3
. Below is defined so that p1
, p2
and p3
appear in counterclockwise order when viewed from above the
plane. The returned value is an approximation of six times the
signed volume of the tetrahedron defined by the four points. This
function uses adaptive floating point arithmetic and is
consequently geometrically robust.
p1 : | a GtsPoint. |
p2 : | a GtsPoint. |
p3 : | a GtsPoint. |
p4 : | a GtsPoint. |
Returns : | a positive value if |
gint gts_point_orientation_3d_sos (GtsPoint *p1, GtsPoint *p2, GtsPoint *p3, GtsPoint *p4);
Checks if p4
lies above or below the plane passing through the
points p1
, p2
and p3
. Below is defined so that p1
, p2
and p3
appear in counterclockwise order when viewed from above the
plane. This function uses adaptive floating point arithmetic and is
consequently geometrically robust.
Simulation of Simplicity (SoS) is used to break ties when the
orientation is degenerate (i.e. p4
lies on the plane defined by
p1
, p2
and p3
).
p1 : | a GtsPoint. |
p2 : | a GtsPoint. |
p3 : | a GtsPoint. |
p4 : | a GtsPoint. |
Returns : | +1 if |
GtsIntersect gts_point_is_in_triangle (GtsPoint *p, GtsTriangle *t);
Tests if the planar projection (x, y) of p
is inside, outside or
on the boundary of the planar projection of t
. This function is
geometrically robust.
p : | a GtsPoint. |
t : | a GtsTriangle. |
Returns : | |
gdouble gts_point_in_circle (GtsPoint *p, GtsPoint *p1, GtsPoint *p2, GtsPoint *p3);
Tests if the planar projection (x, y) of p
is inside or outside the
circle defined by the planar projection of p1
, p2
and p3
.
p : | a GtsPoint. |
p1 : | a GtsPoint. |
p2 : | a GtsPoint. |
p3 : | a GtsPoint. |
Returns : | a positive number if |
gdouble gts_point_in_sphere (GtsPoint *p, GtsPoint *p1, GtsPoint *p2, GtsPoint *p3, GtsPoint *p4);
Tests if p
is inside or outside the sphere defined by p1
, p2
,
p3
and p4
.
p : | a GtsPoint. |
p1 : | a GtsPoint. |
p2 : | a GtsPoint. |
p3 : | a GtsPoint. |
p4 : | a GtsPoint. |
Returns : | a positive number if |
gdouble gts_point_in_triangle_circle (GtsPoint *p, GtsTriangle *t);
Tests if the planar projection (x, y) of p
is inside or outside
the circumcircle of the planar projection of t
. This function is
geometrically robust.
p : | a GtsPoint. |
t : | a GtsTriangle. |
Returns : | a positive number if |
gdouble gts_point_orientation (GtsPoint *p1, GtsPoint *p2, GtsPoint *p3);
Checks for orientation of the projection of three points on the (x,y) plane. The result is also an approximation of twice the signed area of the triangle defined by the three points. This function uses adaptive floating point arithmetic and is consequently geometrically robust.
p1 : | a GtsPoint. |
p2 : | a GtsPoint. |
p3 : | a GtsPoint. |
Returns : | a positive value if |
gint gts_point_orientation_sos (GtsPoint *p1, GtsPoint *p2, GtsPoint *p3);
Checks for orientation of the projection of three points on the (x,y) plane.
Simulation of Simplicity (SoS) is used to break ties when the
orientation is degenerate (i.e. p3
lies on the line defined by
p1
and p2
).
p1 : | a GtsPoint. |
p2 : | a GtsPoint. |
p3 : | a GtsPoint. |
Returns : | a positive value if |
gdouble gts_point_segment_distance2 (GtsPoint *p, GtsSegment *s);
p : | a GtsPoint. |
s : | a GtsSegment. |
Returns : | the square of the minimun Euclidean distance between |
gdouble gts_point_segment_distance (GtsPoint *p, GtsSegment *s);
p : | a GtsPoint. |
s : | a GtsSegment. |
Returns : | the minimun Euclidean distance between |
void gts_point_segment_closest (GtsPoint *p, GtsSegment *s, GtsPoint *closest);
Set the coordinates of closest
to the coordinates of the point belonging
to s
closest to p
.
p : | a GtsPoint. |
s : | a GtsSegment. |
closest : | a GtsPoint. |
gdouble gts_point_triangle_distance2 (GtsPoint *p, GtsTriangle *t);
p : | a GtsPoint. |
t : | a GtsTriangle. |
Returns : | the square of the minimun Euclidean distance between |
gdouble gts_point_triangle_distance (GtsPoint *p, GtsTriangle *t);
p : | a GtsPoint. |
t : | a GtsTriangle. |
Returns : | the minimun Euclidean distance between |
void gts_point_triangle_closest (GtsPoint *p, GtsTriangle *t, GtsPoint *closest);
Set the coordinates of closest
to those of the point belonging to t
and
closest to p
.
p : | a GtsPoint. |
t : | a GtsTriangle. |
closest : | a GtsPoint. |
gboolean gts_point_is_inside_surface (GtsPoint *p,GNode *tree,gboolean is_open);
p : | a GtsPoint. |
tree : | a bounding box tree of the faces of a closed, orientable
surface (see |
is_open : | |
Returns : | |
GtsVertex * gts_vertex_new (GtsVertexClass *klass,gdouble x,gdouble y,gdouble z);
klass : | a |
x : | the x-coordinate of the vertex to create. |
y : | the y-coordinate of the vertex to create. |
z : | the y-coordinate of the vertex to create. |
Returns : | a new GtsVertex with |
void gts_vertex_replace (GtsVertex *v, GtsVertex *with);
Replaces vertex v
with vertex with
. v
and with
must be
different. All the GtsSegment which have v
has one of their
vertices are updated. The segments list of vertex v
is freed and
v
->segments is set to
v : | a GtsVertex. |
with : | another GtsVertex. |
gboolean gts_vertex_is_unattached (GtsVertex *v);
v : | a GtsVertex. |
Returns : | |
GtsSegment * gts_vertices_are_connected (GtsVertex *v1, GtsVertex *v2);
v1 : | a GtsVertex. |
v2 : | another GtsVertex. |
Returns : | if |
GSList * gts_vertex_triangles (GtsVertex *v,GSList *list);
Adds all the GtsTriangle which share v
as a vertex and do not
already belong to list
.
v : | a GtsVertex. |
list : | a list of GtsTriangle. |
Returns : | the new list of unique GtsTriangle which share |
GSList * gts_vertex_faces (GtsVertex *v, GtsSurface *surface,GSList *list);
Adds all the GtsFace belonging to surface
(if not v
as a vertex and do not already belong to list
.
v : | a GtsVertex. |
surface : | a GtsSurface or |
list : | a list of GtsFace. |
Returns : | the new list of unique GtsFace belonging to |
GSList * gts_vertex_neighbors (GtsVertex *v,GSList *list, GtsSurface *surface);
Adds to list
all the GtsVertex connected to v
by a GtsSegment and not
already in list
. If surface
is not v
by an edge belonging to surface
are considered.
v : | a GtsVertex. |
list : | a list of GtsVertex. |
surface : | a GtsSurface or |
Returns : | the new list of unique GtsVertex. |
GSList * gts_vertices_from_segments (GSList *segments);
segments : | a list of GtsSegment. |
Returns : | a list of GtsVertex, vertices of a GtsSegment in |
gboolean gts_vertex_is_boundary (GtsVertex *v, GtsSurface *surface);
v : | a GtsVertex. |
surface : | a GtsSurface or |
Returns : | |
GList * gts_vertices_merge (GList *vertices,gdouble epsilon,gboolean (checkGtsVertex *, GtsVertex *) ());
For each vertex v in vertices
look if there are any vertex of
vertices
contained in a box centered on v of size 2*epsilon
. If
there are and if check
is not gts_vertex_replace()
), destroy them and remove
them from list. This is done efficiently using Kd-Trees.
vertices : | a list of GtsVertex. |
epsilon : | half the size of the bounding box to consider for each vertex. |
check : | function called for each pair of vertices about to be merged
or |
Returns : | the updated list of vertices. |
GSList * gts_vertex_fan_oriented (GtsVertex *v, GtsSurface *surface);
v : | a GtsVertex. |
surface : | a GtsSurface. |
Returns : | a list of GtsEdge describing in counterclockwise order the
boundary of the fan of summit |
guint gts_vertex_is_contact (GtsVertex *v,gboolean sever);
v : | a GtsVertex. |
sever : | if |
Returns : | the number of sets of connected triangles sharing |
GtsSegment * gts_segment_new (GtsSegmentClass *klass, GtsVertex *v1, GtsVertex *v2);
klass : | a |
v1 : | a GtsVertex. |
v2 : | another GtsVertex different from |
Returns : | a new GtsSegment linking |
GtsIntersect gts_segments_are_intersecting (GtsSegment *s1, GtsSegment *s2);
s1 : | a GtsSegment. |
s2 : | a GtsSegment. |
Returns : | |
GtsSegment * gts_segment_is_duplicate (GtsSegment *s);
s : | a GtsSegment. |
Returns : | the first GtsSegment different from |
GtsVertex * gts_segment_midvertex (GtsSegment *s,GtsVertexClass *klass);
s : | a GtsSegment. |
klass : | a |
Returns : | a new GtsVertex, midvertex of |
GSList * gts_segments_from_vertices (GSList *vertices);
vertices : | a list of GtsVertex. |
Returns : | a list of unique GtsSegment which have one of their vertices in
|
gboolean gts_segment_is_ok (GtsSegment *s);
s : | a GtsSegment. |
Returns : | |
GtsEdge * gts_edge_new (GtsEdgeClass *klass, GtsVertex *v1, GtsVertex *v2);
klass : | a |
v1 : | a GtsVertex. |
v2 : | a GtsVertex. |
Returns : | a new GtsEdge linking |
#define gts_edge_is_unattached(s) ((s)->triangles == NULL ? TRUE : FALSE)
Evaluates to s
as an edge,
s : | a GtsEdge. |
GtsFace * gts_edge_has_parent_surface (GtsEdge *e, GtsSurface *surface);
e : | a GtsEdge. |
surface : | a GtsSurface. |
Returns : | a GtsFace of |
GtsFace * gts_edge_has_any_parent_surface (GtsEdge *e);
e : | a GtsEdge. |
Returns : | |
GtsFace * gts_edge_is_boundary (GtsEdge *e, GtsSurface *surface);
e : | a GtsEdge. |
surface : | a GtsSurface or |
Returns : | the unique GtsFace (which belongs to |
void gts_edge_replace (GtsEdge *e, GtsEdge *with);
Replaces e
with with
. For each triangle which uses e
as an
edge, e
is replaced with with
. The with
->triangles list is
updated appropriately and the e
->triangles list is freed and set
to
e : | a GtsEdge. |
with : | a GtsEdge. |
GSList * gts_edges_from_vertices (GSList *vertices, GtsSurface *parent);
vertices : | a list of GtsVertex. |
parent : | a GtsSurface. |
Returns : | a list of unique GtsEdge which have one of their vertices in
|
guint gts_edge_face_number (GtsEdge *e, GtsSurface *s);
e : | a GtsEdge. |
s : | a GtsSurface. |
Returns : | the number of faces using |
gboolean gts_edge_collapse_is_valid (GtsEdge *e);
An implementation of the topological constraints described in the "Mesh Optimization" article of Hoppe et al (1993).
e : | a GtsEdge. |
Returns : | |
gboolean gts_edge_collapse_creates_fold (GtsEdge *e, GtsVertex *v,gdouble max);
e : | a GtsEdge. |
v : | a GtsVertex. |
max : | the maximum value of the square of the cosine of the angle between two triangles. |
Returns : | |
GtsEdge * gts_edge_is_duplicate (GtsEdge *e);
e : | a GtsEdge. |
Returns : | the first GtsEdge different from |
GList * gts_edges_merge (GList *edges);
For each edge in edges
check if it is duplicated (as
returned by gts_edge_is_duplicate()
). If it is replace it by its
duplicate, destroy it and remove it from the list.
edges : | a list of GtsEdge. |
Returns : | the updated |
gboolean gts_edge_belongs_to_tetrahedron (GtsEdge *e);
e : | a GtsEdge. |
Returns : | |
guint gts_edge_is_contact (GtsEdge *e);
e : | a GtsEdge. |
Returns : | the number of sets of connected triangles sharing |
void gts_edge_swap (GtsEdge *e, GtsSurface *s);
Performs an "edge swap" on the two triangles sharing e
and
belonging to s
.
e : | a GtsEdge. |
s : | a GtsSurface. |
gboolean gts_edge_manifold_faces (GtsEdge *e, GtsSurface *s, GtsFace **f1, GtsFace **f2);
If e
is a manifold edge of surface s
, fills f1
and f2
with the
faces belonging to s
and sharing e
.
e : | a GtsEdge. |
s : | a GtsSurface. |
f1 : | pointer for first face. |
f2 : | pointer for second face. |
Returns : | |
typedef struct { GtsObject object; GtsEdge * e1; GtsEdge * e2; GtsEdge * e3; } GtsTriangle;
void gts_triangle_set (GtsTriangle *triangle, GtsEdge *e1, GtsEdge *e2, GtsEdge *e3);
Sets the edge of triangle
to e1
, e2
and e3
while checking that they
define a valid triangle.
triangle : | a GtsTriangle. |
e1 : | a GtsEdge. |
e2 : | another GtsEdge touching |
e3 : | another GtsEdge touching both |
GtsTriangle * gts_triangle_new (GtsTriangleClass *klass, GtsEdge *e1, GtsEdge *e2, GtsEdge *e3);
klass : | a |
e1 : | a GtsEdge. |
e2 : | another GtsEdge touching |
e3 : | another GtsEdge touching both |
Returns : | a new GtsTriangle having |
GtsVertex * gts_triangle_vertex_opposite (GtsTriangle *t, GtsEdge *e);
This function fails if e
is not an edge of t
.
t : | a GtsTriangle. |
e : | a GtsEdge used by |
Returns : | a GtsVertex, vertex of |
GtsEdge * gts_triangle_edge_opposite (GtsTriangle *t, GtsVertex *v);
t : | a GtsTriangle. |
v : | a GtsVertex of |
Returns : | the edge of |
gdouble gts_triangles_angle (GtsTriangle *t1, GtsTriangle *t2);
t1 : | a GtsTriangle. |
t2 : | a GtsTriangle. |
Returns : | the value (in radians) of the angle between |
gboolean gts_triangles_are_compatible (GtsTriangle *t1, GtsTriangle *t2, GtsEdge *e);
Checks if t1
and t2
have compatible orientations i.e. if t1
and
t2
can be part of the same surface without conflict in the surface
normal orientation.
t1 : | a GtsTriangle. |
t2 : | a GtsTriangle. |
e : | a GtsEdge used by both |
Returns : | |
gdouble gts_triangle_area (GtsTriangle *t);
t : | a GtsTriangle. |
Returns : | the area of the triangle |
gdouble gts_triangle_perimeter (GtsTriangle *t);
t : | a GtsTriangle. |
Returns : | the perimeter of the triangle |
gdouble gts_triangle_quality (GtsTriangle *t);
The quality of a triangle is defined as the ratio of the square root of its surface area to its perimeter relative to this same ratio for an equilateral triangle with the same area. The quality is then one for an equilateral triangle and tends to zero for a very stretched triangle.
t : | a GtsTriangle. |
Returns : | the quality of the triangle |
void gts_triangle_normal (GtsTriangle *t,gdouble *x,gdouble *y,gdouble *z);
Computes the coordinates of the oriented normal of t
as the
cross-product of two edges, using the left-hand rule. The normal is
not normalized. If this triangle is part of a closed and oriented
surface, the normal points to the outside of the surface.
t : | a GtsTriangle. |
x : | the x coordinate of the normal. |
y : | the y coordinate of the normal. |
z : | the z coordinate of the normal. |
gdouble gts_triangle_orientation (GtsTriangle *t);
Checks for the orientation of the plane (x,y) projection of a
triangle. See gts_point_orientation()
for details. This function
is geometrically robust.
t : | a GtsTriangle. |
Returns : | a number depending on the orientation of the vertices of |
void gts_triangle_revert (GtsTriangle *t);
Changes the orientation of triangle t
, turning it inside out.
t : | a GtsTriangle. |
GSList * gts_triangles_from_edges (GSList *edges);
Builds a list of unique triangles which have one of their edges in edges
.
edges : | a list of GtsEdge. |
Returns : | the list of triangles. |
void gts_triangle_vertices_edges (GtsTriangle *t, GtsEdge *e, GtsVertex **v1, GtsVertex **v2, GtsVertex **v3, GtsEdge **e1, GtsEdge **e2, GtsEdge **e3);
Given t
and e
, returns v1
, v2
, v3
, e1
, e2
and e3
. e1
has v1
and v2
as vertices, e2
has v2
and v3
as vertices
and e3
has v3
and v1
as vertices. v1
, v2
and v3
respects
the orientation of t
. If e
is not NULL, e1
and e
are
identical.
t : | a GtsTriangle. |
e : | a GtsEdge belonging to the edges of |
v1 : | a GtsVertex used by |
v2 : | a GtsVertex used by |
v3 : | a GtsVertex used by |
e1 : | a GtsEdge used by |
e2 : | a GtsEdge used by |
e3 : | a GtsEdge used by |
GtsTriangle * gts_triangle_enclosing (GtsTriangleClass *klass,GSList *points,gdouble scale);
Builds a new triangle (including new vertices and edges) enclosing
the plane projection of all the points in points
. This triangle is
equilateral and encloses a rectangle defined by the maximum and
minimum x and y coordinates of the points. scale
is an homothetic
scaling factor. If equal to one, the triangle encloses exactly the
enclosing rectangle.
klass : | the class of the new triangle. |
points : | a list of GtsPoint. |
scale : | a scaling factor (must be larger than one). |
Returns : | a new GtsTriangle. |
guint gts_triangle_neighbor_number (GtsTriangle *t);
t : | a GtsTriangle. |
Returns : | the number of triangles neighbors of |
GSList * gts_triangle_neighbors (GtsTriangle *t);
t : | a GtsTriangle. |
Returns : | a list of GtsTriangle neighbors of |
GtsEdge * gts_triangles_common_edge (GtsTriangle *t1, GtsTriangle *t2);
t1 : | a GtsTriangle. |
t2 : | a GtsTriangle. |
Returns : | a GtsEdge common to both |
GtsTriangle * gts_triangle_is_duplicate (GtsTriangle *t);
t : | a GtsTriangle. |
Returns : | a GtsTriangle different from |
GtsTriangle * gts_triangle_use_edges (GtsEdge *e1, GtsEdge *e2, GtsEdge *e3);
e1 : | a GtsEdge. |
e2 : | a GtsEdge. |
e3 : | a GtsEdge. |
Returns : | a GtsTriangle having |
gboolean gts_triangle_is_ok (GtsTriangle *t);
t : | a GtsTriangle. |
Returns : | |
void gts_triangle_vertices (GtsTriangle *t, GtsVertex **v1, GtsVertex **v2, GtsVertex **v3);
Fills v1
, v2
and v3
with the oriented set of vertices, summits of t
.
t : | a GtsTriangle. |
v1 : | a pointer on a GtsVertex. |
v2 : | a pointer on a GtsVertex. |
v3 : | a pointer on a GtsVertex. |
GtsPoint * gts_triangle_circumcircle_center (GtsTriangle *t,GtsPointClass *point_class);
t : | a GtsTriangle. |
point_class : | a |
Returns : | a new GtsPoint, center of the circumscribing circle of |
gboolean gts_triangles_are_folded (GSList *triangles, GtsVertex *A, GtsVertex *B,gdouble max);
Given a list of triangles sharing A
and B
as vertices, checks if any
two triangles in the list make an angle larger than a given value defined
by max
.
triangles : | a list of GtsTriangle. |
A : | a GtsVertex. |
B : | another GtsVertex. |
max : | the maximum value of the square of the cosine of the angle between two triangles. |
Returns : | |
GtsObject * gts_triangle_is_stabbed (GtsTriangle *t, GtsPoint *p,gdouble *orientation);
t : | a GtsTriangle. |
p : | a GtsPoint. |
orientation : | a pointer or |
Returns : | one of the vertices of |
void gts_triangle_interpolate_height (GtsTriangle *t, GtsPoint *p);
Fills the z-coordinate of point p
belonging to the plane
projection of triangle t
with the linearly interpolated value of
the z-coordinates of the vertices of t
.
t : | a GtsTriangle. |
p : | a GtsPoint. |
GtsFace * gts_face_new (GtsFaceClass *klass, GtsEdge *e1, GtsEdge *e2, GtsEdge *e3);
klass : | a |
e1 : | a GtsEdge. |
e2 : | a GtsEdge. |
e3 : | a GtsEdge. |
Returns : | a new GtsFace using |
gboolean gts_face_has_parent_surface (GtsFace *f, GtsSurface *s);
f : | a GtsFace. |
s : | a GtsSurface. |
Returns : | |
GSList * gts_faces_from_edges (GSList *edges, GtsSurface *s);
Builds a list of unique faces which belong to s
and have
one of their edges in edges
.
edges : | a list of GtsEdge. |
s : | a GtsSurface or |
Returns : | the list of faces. |
guint gts_face_neighbor_number (GtsFace *f, GtsSurface *s);
f : | a GtsFace. |
s : | a GtsSurface or |
Returns : | the number of faces neighbors of |
GSList * gts_face_neighbors (GtsFace *f, GtsSurface *s);
f : | a GtsFace. |
s : | a GtsSurface or |
Returns : | a list of unique GtsFace neighbors of |
void gts_face_foreach_neighbor (GtsFace *f, GtsSurface *s, GtsFunc func,gpointer data);
Calls func
for each neighbor of f
belonging to s
(if not
f : | a GtsFace. |
s : | a GtsSurface or |
func : | a GtsFunc. |
data : | user data to pass to |
gboolean gts_face_is_compatible (GtsFace *f, GtsSurface *s);
f : | a GtsFace. |
s : | a GtsSurface. |
Returns : | |
GtsMatrix * gts_matrix_new (gdouble a00,gdouble a01,gdouble a02,gdouble a03,gdouble a10,gdouble a11,gdouble a12,gdouble a13,gdouble a20,gdouble a21,gdouble a22,gdouble a23,gdouble a30,gdouble a31,gdouble a32,gdouble a33);
Allocates memory and initializes a new GtsMatrix.
a00 : | element [0][0]. |
a01 : | element [0][1]. |
a02 : | element [0][2]. |
a03 : | element [0][3]. |
a10 : | element [1][0]. |
a11 : | element [1][1]. |
a12 : | element [1][2]. |
a13 : | element [1][3]. |
a20 : | element [2][0]. |
a21 : | element [2][1]. |
a22 : | element [2][2]. |
a23 : | element [2][3]. |
a30 : | element [3][0]. |
a31 : | element [3][1]. |
a32 : | element [3][2]. |
a33 : | element [3][3]. |
Returns : | a pointer to the newly created GtsMatrix. |
void gts_matrix_assign (GtsMatrix *m,gdouble a00,gdouble a01,gdouble a02,gdouble a03,gdouble a10,gdouble a11,gdouble a12,gdouble a13,gdouble a20,gdouble a21,gdouble a22,gdouble a23,gdouble a30,gdouble a31,gdouble a32,gdouble a33);
Set values of matrix elements.
m : | a GtsMatrix. |
a00 : | element [0][0]. |
a01 : | element [0][1]. |
a02 : | element [0][2]. |
a03 : | element [0][3]. |
a10 : | element [1][0]. |
a11 : | element [1][1]. |
a12 : | element [1][2]. |
a13 : | element [1][3]. |
a20 : | element [2][0]. |
a21 : | element [2][1]. |
a22 : | element [2][2]. |
a23 : | element [2][3]. |
a30 : | element [3][0]. |
a31 : | element [3][1]. |
a32 : | element [3][2]. |
a33 : | element [3][3]. |
GtsMatrix * gts_matrix_projection (GtsTriangle *t);
Creates a new GtsMatrix representing the projection onto a plane of normal
given by t
.
t : | a GtsTriangle. |
Returns : | a pointer to the newly created GtsMatrix. |
GtsMatrix * gts_matrix_transpose (GtsMatrix *m);
m : | a GtsMatrix. |
Returns : | a pointer to a newly created GtsMatrix transposed of |
gdouble gts_matrix_determinant (GtsMatrix *m);
m : | a GtsMatrix. |
Returns : | the value of det( |
GtsMatrix * gts_matrix_inverse (GtsMatrix *m);
m : | a GtsMatrix. |
Returns : | a pointer to a newly created GtsMatrix inverse of |
GtsMatrix * gts_matrix3_inverse (GtsMatrix *m);
m : | a 3x3 GtsMatrix. |
Returns : | a pointer to a newly created 3x3 GtsMatrix inverse of |
void gts_matrix_print (GtsMatrix *m,FILE *fptr);
Print m
to file fptr
.
m : | a GtsMatrix. |
fptr : | a file descriptor. |
guint gts_matrix_compatible_row (GtsMatrix *A, GtsVector b,guint n, GtsVector A1,gdouble b1);
Given a system of n
constraints A.x
=b
adds to it the compatible
constraints defined by A1.x
=b1
. The compatibility is determined
by insuring that the resulting system is well-conditioned (see
Lindstrom and Turk (1998, 1999)).
A : | a GtsMatrix. |
b : | a GtsVector. |
n : | the number of previous constraints of |
A1 : | a GtsMatrix. |
b1 : | a GtsVector. |
Returns : | the number of constraints of the resulting system. |
guint gts_matrix_quadratic_optimization (GtsMatrix *A, GtsVector b,guint n, GtsMatrix *H, GtsVector c);
Solve a quadratic optimization problem: Given a quadratic objective function
f which can be written as: f(x) = x^t.H.x
+ c
^t.x + k, where H
is the
symmetric positive definite Hessian of f and k is a constant, find the
minimum of f subject to the set of n
prior linear constraints, defined by
the first n
rows of A
and b
(A.x
= b
). The new constraints given by
the minimization are added to A
and b
only if they are linearly
independent as determined by gts_matrix_compatible_row()
.
A : | a GtsMatrix. |
b : | a GtsVector. |
n : | the number of constraints (must be smaller than 3). |
H : | a symmetric positive definite Hessian. |
c : | a GtsVector. |
Returns : | the new number of constraints defined by |
GtsMatrix * gts_matrix_product (GtsMatrix *m1, GtsMatrix *m2);
m1 : | a GtsMatrix. |
m2 : | another GtsMatrix. |
Returns : | a new GtsMatrix, product of |
GtsMatrix * gts_matrix_zero (GtsMatrix *m);
Initializes m
to zeros. Allocates a matrix if m
is
m : | a GtsMatrix or $NULL. |
Returns : | the zero'ed matrix. |
GtsMatrix * gts_matrix_identity (GtsMatrix *m);
Initializes m
to an identity matrix. Allocates a matrix if m
is
m : | a GtsMatrix or |
Returns : | the identity matrix. |
GtsMatrix * gts_matrix_scale (GtsMatrix *m, GtsVector s);
Initializes m
to a scaling matrix for s
. Allocates a matrix if m
is
m : | a GtsMatrix or |
s : | the scaling vector. |
Returns : | the scaling matrix. |
GtsMatrix * gts_matrix_translate (GtsMatrix *m, GtsVector t);
Initializes m
to a translation matrix for t
. Allocates a new
matrix if m
is
m : | a GtsMatrix or |
t : | the translation vector. |
Returns : | the translation matix. |
GtsMatrix * gts_matrix_rotate (GtsMatrix *m, GtsVector r,gdouble angle);
Initializes m
to a rotation matrix around r
by angle
.
Allocates a new matrix if m
is
m : | a GtsMatrix or |
r : | the rotation axis. |
angle : | the angle (in radians) to rotate by. |
Returns : | the rotation matrix. |
void gts_matrix_destroy (GtsMatrix *m);
Free all the memory allocated for m
.
m : | a GtsMatrix. |
void gts_vector_print (GtsVector v,FILE *fptr);
Print s
to file fptr
.
v : | a GtsVector. |
fptr : | a file descriptor. |
void gts_vector4_print (GtsVector4 v,FILE *fptr);
Print v
to file fptr
.
v : | a GtsVector4. |
fptr : | a file descriptor. |
GNode * gts_kdtree_new (GPtrArray *points,int (compareconst void *,const void *) ());
Note that the order of the points in array points
is modified by this
function.
points : | an array of GtsPoint. |
compare : | always |
Returns : | a new 3D tree for |
GSList * gts_kdtree_range (GNode *tree, GtsBBox *bbox,int (compareconst void *,const void *) ());
tree : | a 3D tree. |
bbox : | a GtsBBox. |
compare : | always |
Returns : | a list of GtsPoint belonging to |
void (*GtsBBTreeTraverseFunc) (GtsBBox *bb1, GtsBBox *bb2,gpointer data);
User function called for each pair of overlapping bounding
boxes. See gts_bb_tree_traverse_overlapping()
.
bb1 : | a GtsBBox. |
bb2 : | another GtsBBox. |
data : | user data passed to the function. |
gdouble (*GtsBBoxDistFunc) (GtsPoint *p,gpointer bounded);
User function returning the (minimum) distance between the object
defined by bounded
and point p
.
p : | a GtsPoint. |
bounded : | an object bounded by a GtsBBox. |
Returns : | the distance between |
GtsPoint * (*GtsBBoxClosestFunc) (GtsPoint *p,gpointer bounded);
User function returning a GtsPoint belonging to the object defined
by bounded
and closest to p
.
p : | a GtsPoint. |
bounded : | an object bounded by a GtsBBox. |
Returns : | a GtsPoint. |
#define GTS_IS_BBOX(obj)
Evaluates to obj
is a GtsBBox,
obj : | a GtsObject. |
#define GTS_BBOX_CLASS(klass)
Casts klass
to
klass : | a descendant of |
typedef struct { GtsObject object; gpointer bounded; gdouble x1, y1, z1; gdouble x2, y2, z2; } GtsBBox;
GtsBBox * gts_bbox_new (GtsBBoxClass *klass,gpointer bounded,gdouble x1,gdouble y1,gdouble z1,gdouble x2,gdouble y2,gdouble z2);
klass : | a |
bounded : | the object to be bounded. |
x1 : | x-coordinate of the lower left corner. |
y1 : | y-coordinate of the lower left corner. |
z1 : | z-coordinate of the lower left corner. |
x2 : | x-coordinate of the upper right corner. |
y2 : | y-coordinate of the upper right corner. |
z2 : | z-coordinate of the upper right corner. |
Returns : | a new GtsBBox. |
void gts_bbox_set (GtsBBox *bbox,gpointer bounded,gdouble x1,gdouble y1,gdouble z1,gdouble x2,gdouble y2,gdouble z2);
Sets fields of bbox
.
bbox : | a GtsBBox. |
bounded : | the object to be bounded. |
x1 : | x-coordinate of the lower left corner. |
y1 : | y-coordinate of the lower left corner. |
z1 : | z-coordinate of the lower left corner. |
x2 : | x-coordinate of the upper right corner. |
y2 : | y-coordinate of the upper right corner. |
z2 : | z-coordinate of the upper right corner. |
GtsBBox * gts_bbox_segment (GtsBBoxClass *klass, GtsSegment *s);
klass : | a |
s : | a GtsSegment. |
Returns : | a new GtsBBox bounding box of |
GtsBBox * gts_bbox_triangle (GtsBBoxClass *klass, GtsTriangle *t);
klass : | a |
t : | a GtsTriangle. |
Returns : | a new GtsBBox bounding box of |
GtsBBox * gts_bbox_surface (GtsBBoxClass *klass, GtsSurface *surface);
klass : | a |
surface : | a GtsSurface. |
Returns : | a new GtsBBox bounding box of |
GtsBBox * gts_bbox_bboxes (GtsBBoxClass *klass,GSList *bboxes);
klass : | a |
bboxes : | a list of GtsBBox. |
Returns : | a new GtsBBox bounding box of all the bounding boxes in
|
GtsBBox * gts_bbox_points (GtsBBoxClass *klass,GSList *points);
klass : | a |
points : | a list of GtsPoint. |
Returns : | a new GtsBBox bounding box of |
#define gts_bbox_point_is_inside(bbox, p)
Evaluates to p
is inside (or on the boundary) of bbox
,
bbox : | a GtsBBox. |
p : | a GtsPoint. |
gboolean gts_bboxes_are_overlapping (GtsBBox *bb1, GtsBBox *bb2);
bb1 : | a GtsBBox. |
bb2 : | a GtsBBox. |
Returns : | |
void gts_bbox_draw (GtsBBox *bb,FILE *fptr);
Writes in file fptr
an OOGL (Geomview) description of bb
.
bb : | a GtsBBox. |
fptr : | a file pointer. |
gdouble gts_bbox_diagonal2 (GtsBBox *bb);
bb : | a GtsBBox. |
Returns : | the squared length of the diagonal of |
void gts_bbox_point_distance2 (GtsBBox *bb, GtsPoint *p,gdouble *min,gdouble *max);
Sets min
and max
to lower and upper bounds for the square of the
Euclidean distance between the object contained in bb
and p
. For these
bounds to make any sense the bounding box must be "tight" i.e. each of the
6 faces of the box must at least be touched by one point of the bounded
object.
bb : | a GtsBBox. |
p : | a GtsPoint. |
min : | a pointer on a gdouble. |
max : | a pointer on a gdouble. |
gboolean gts_bbox_is_stabbed (GtsBBox *bb, GtsPoint *p);
bb : | a GtsBBox. |
p : | a GtsPoint. |
Returns : | |
gboolean gts_bbox_overlaps_triangle (GtsBBox *bb, GtsTriangle *t);
This is a wrapper around the fast overlap test of Tomas Akenine-Moller (http://www.cs.lth.se/home/Tomas_Akenine_Moller/).
bb : | a GtsBBox. |
t : | a GtsTriangle. |
Returns : | |
gboolean gts_bbox_overlaps_segment (GtsBBox *bb, GtsSegment *s);
This functions uses gts_bbox_overlaps_triangle()
with a degenerate
triangle.
bb : | a GtsBBox. |
s : | a GtsSegment. |
Returns : | |
GNode * gts_bb_tree_new (GSList *bboxes);
Builds a new hierarchy of bounding boxes for bboxes
. At each
level, the GNode->data field contains a GtsBBox bounding box of
all the children. The tree is binary and is built by repeatedly
cutting in two approximately equal halves the bounding boxes at
each level until a leaf node (i.e. a bounding box given in bboxes
)
is reached. In order to minimize the depth of the tree, the cutting
direction is always chosen as perpendicular to the longest
dimension of the bounding box.
bboxes : | a list of GtsBBox. |
Returns : | a new hierarchy of bounding boxes. |
GNode * gts_bb_tree_surface (GtsSurface *s);
s : | a GtsSurface. |
Returns : | a new hierarchy of bounding boxes bounding the faces of |
GSList * gts_bb_tree_stabbed (GNode *tree, GtsPoint *p);
tree : | a bounding box tree. |
p : | a GtsPoint. |
Returns : | a list of bounding boxes, leaves of |
GSList * gts_bb_tree_overlap (GNode *tree, GtsBBox *bbox);
tree : | a bounding box tree. |
bbox : | a GtsBBox. |
Returns : | a list of bounding boxes, leaves of |
gboolean gts_bb_tree_is_overlapping (GNode *tree, GtsBBox *bbox);
tree : | a bounding box tree. |
bbox : | a GtsBBox. |
Returns : | |
void gts_bb_tree_traverse_overlapping (GNode *tree1,GNode *tree2, GtsBBTreeTraverseFunc func,gpointer data);
Calls func
for each overlapping pair of leaves of tree1
and tree2
.
tree1 : | a bounding box tree. |
tree2 : | a bounding box tree. |
func : | |
data : | user data to be passed to |
void gts_bb_tree_draw (GNode *tree,guint depth,FILE *fptr);
Write in fptr
an OOGL (Geomview) description of tree
for the
depth specified by depth
.
tree : | a bounding box tree. |
depth : | a specified depth. |
fptr : | a file pointer. |
GSList * gts_bb_tree_point_closest_bboxes (GNode *tree, GtsPoint *p);
tree : | a bounding box tree. |
p : | a GtsPoint. |
Returns : | a list of GtsBBox. One of the bounding boxes is assured to contain
the object of |
gdouble gts_bb_tree_point_distance (GNode *tree, GtsPoint *p, GtsBBoxDistFunc distance, GtsBBox **bbox);
tree : | a bounding box tree. |
p : | a GtsPoint. |
distance : | |
bbox : | if not |
Returns : | the distance as evaluated by |
GtsPoint * gts_bb_tree_point_closest (GNode *tree, GtsPoint *p, GtsBBoxClosestFunc closest,gdouble *distance);
tree : | a bounding box tree. |
p : | a GtsPoint. |
closest : | |
distance : | if not |
Returns : | a new GtsPoint, closest point to |
void gts_bb_tree_segment_distance (GNode *tree, GtsSegment *s, GtsBBoxDistFunc distance,gdouble delta, GtsRange *range);
Given a segment s
, points are sampled regularly on its length
using delta
as increment. The distance from each of these points
to the closest object of tree
is computed using distance
and the
gts_bb_tree_point_distance()
function. The fields of range
are
filled with the number of points sampled, the minimum, average and
maximum value and the standard deviation.
tree : | a bounding box tree. |
s : | a GtsSegment. |
distance : | |
delta : | spatial scale of the sampling to be used. |
range : | a GtsRange to be filled with the results. |
void gts_bb_tree_triangle_distance (GNode *tree, GtsTriangle *t, GtsBBoxDistFunc distance,gdouble delta, GtsRange *range);
Given a triangle t
, points are sampled regularly on its surface
using delta
as increment. The distance from each of these points
to the closest object of tree
is computed using distance
and the
gts_bb_tree_point_distance()
function. The fields of range
are
filled with the number of points sampled, the minimum, average and
maximum value and the standard deviation.
tree : | a bounding box tree. |
t : | a GtsTriangle. |
distance : | |
delta : | spatial scale of the sampling to be used. |
range : | a GtsRange to be filled with the results. |
void gts_bb_tree_surface_distance (GNode *tree, GtsSurface *s, GtsBBoxDistFunc distance,gdouble delta, GtsRange *range);
Calls gts_bb_tree_triangle_distance()
for each face of s
. The
fields of range
are filled with the minimum, maximum and average
distance. The average distance is defined as the sum of the average
distances for each triangle weighthed by their area and divided by
the total area of the surface. The standard deviation is defined
accordingly. The n
field of range
is filled with the number of
sampled points used.
tree : | a bounding box tree. |
s : | a GtsSurface. |
distance : | |
delta : | a sampling increment defined as the percentage of the diagonal
of the root bounding box of |
range : | a GtsRange to be filled with the results. |
void gts_bb_tree_surface_boundary_distance (GNode *tree, GtsSurface *s, GtsBBoxDistFunc distance,gdouble delta, GtsRange *range);
Calls gts_bb_tree_segment_distance()
for each edge boundary of s
.
The fields of range
are filled with the minimum, maximum and
average distance. The average distance is defined as the sum of the
average distances for each boundary edge weighthed by their length
and divided by the total length of the boundaries. The standard
deviation is defined accordingly. The n
field of range
is filled
with the number of sampled points used.
tree : | a bounding box tree. |
s : | a GtsSurface. |
distance : | |
delta : | a sampling increment defined as the percentage of the diagonal
of the root bounding box of |
range : | a GtsRange to be filled with the results. |
void gts_bb_tree_destroy (GNode *tree,gboolean free_leaves);
Destroys all the bounding boxes created by tree
and destroys the
tree itself. If free_leaves
is set to
tree : | a bounding box tree. |
free_leaves : | if |
typedef struct { guint n_faces; guint n_incompatible_faces; guint n_duplicate_faces; guint n_duplicate_edges; guint n_boundary_edges; guint n_non_manifold_edges; GtsRange edges_per_vertex, faces_per_edge; GtsSurface * parent; } GtsSurfaceStats;
typedef struct { GtsRange face_quality; GtsRange face_area; GtsRange edge_length; GtsRange edge_angle; GtsSurface * parent; } GtsSurfaceQualityStats;
GtsVertex * (*GtsRefineFunc) (GtsEdge *e,GtsVertexClass *klass,gpointer data);
e : | |
klass : | |
data : | |
Returns : |
GtsVertex * (*GtsCoarsenFunc) (GtsEdge *e,GtsVertexClass *klass,gpointer data);
e : | |
klass : | |
data : | |
Returns : |
gboolean (*GtsStopFunc) (gdouble cost,guint nedge,gpointer data);
cost : | |
nedge : | |
data : | |
Returns : |
typedef struct { GtsObject object; #ifdef USE_SURFACE_BTREE GTree * faces; #else /* not USE_SURFACE_BTREE */ GHashTable * faces; #endif /* not USE_SURFACE_BTREE */ GtsFaceClass * face_class; GtsEdgeClass * edge_class; GtsVertexClass * vertex_class; gboolean keep_faces; } GtsSurface;
GtsSurface * gts_surface_new (GtsSurfaceClass *klass,GtsFaceClass *face_class,GtsEdgeClass *edge_class,GtsVertexClass *vertex_class);
klass : | a |
face_class : | a |
edge_class : | a |
vertex_class : | a |
Returns : | a new empty GtsSurface. |
void gts_surface_add_face (GtsSurface *s, GtsFace *f);
Adds face f
to surface s
.
s : | a GtsSurface. |
f : | a GtsFace. |
void gts_surface_remove_face (GtsSurface *s, GtsFace *f);
Removes face f
from surface s
.
s : | a GtsSurface. |
f : | a GtsFace. |
guint gts_surface_read (GtsSurface *surface, GtsFile *f);
Add to surface
the data read from f
. The format of the file pointed to
by f
is as described in gts_surface_write()
.
surface : | a GtsSurface. |
f : | a GtsFile. |
Returns : | 0 if successful or the line number at which the parsing
stopped in case of error (in which case the |
gdouble gts_surface_area (GtsSurface *s);
s : | a GtsSurface. |
Returns : | the area of |
void gts_surface_stats (GtsSurface *s, GtsSurfaceStats *stats);
Fills stats
with the statistics relevant to surface s
.
s : | a GtsSurface. |
stats : |
void gts_surface_quality_stats (GtsSurface *s, GtsSurfaceQualityStats *stats);
Fills stats
with quality statistics relevant to surface s
.
s : | a GtsSurface. |
stats : |
void gts_surface_print_stats (GtsSurface *s,FILE *fptr);
Writes in the file pointed to by fptr
the statistics for surface s
.
s : | a GtsSurface. |
fptr : | a file pointer. |
void gts_surface_write (GtsSurface *s,FILE *fptr);
Writes in the file fptr
an ASCII representation of s
. The file
format is as follows.
All the lines beginning with GTS_COMMENTS are ignored. The first line contains three unsigned integers separated by spaces. The first integer is the number of vertices, nv, the second is the number of edges, ne and the third is the number of faces, nf.
Follows nv lines containing the x, y and z coordinates of the vertices. Follows ne lines containing the two indices (starting from one) of the vertices of each edge. Follows nf lines containing the three ordered indices (also starting from one) of the edges of each face.
The format described above is the least common denominator to all
GTS files. Consistent with an object-oriented approach, the GTS
file format is extensible. Each of the lines of the file can be
extended with user-specific attributes accessible through the
read()
write()
s : | a GtsSurface. |
fptr : | a file pointer. |
void gts_surface_write_oogl (GtsSurface *s,FILE *fptr);
Writes in the file fptr
an OOGL (Geomview) representation of s
.
s : | a GtsSurface. |
fptr : | a file pointer. |
void gts_surface_write_vtk (GtsSurface *s,FILE *fptr);
Writes in the file fptr
a VTK representation of s
.
s : | a GtsSurface. |
fptr : | a file pointer. |
void gts_surface_write_oogl_boundary (GtsSurface *s,FILE *fptr);
Writes in the file fptr
an OOGL (Geomview) representation of the
boundary of s
.
s : | a GtsSurface. |
fptr : | a file pointer. |
void gts_surface_foreach_vertex (GtsSurface *s, GtsFunc func,gpointer data);
Calls func
once for each vertex of s
.
s : | a GtsSurface. |
func : | a GtsFunc. |
data : | user data to be passed to |
void gts_surface_foreach_edge (GtsSurface *s, GtsFunc func,gpointer data);
Calls func
once for each edge of s
.
s : | a GtsSurface. |
func : | a GtsFunc. |
data : | user data to be passed to |
void gts_surface_foreach_face (GtsSurface *s, GtsFunc func,gpointer data);
Calls func
once for each face of s
.
s : | a GtsSurface. |
func : | a GtsFunc. |
data : | user data to be passed to |
guint gts_surface_foreach_face_remove (GtsSurface *s, GtsFunc func,gpointer data);
Calls func
once for each face of s
. If func
returns s
(and destroyed if it does not
belong to any other surface and
s : | a GtsSurface. |
func : | a GtsFunc. |
data : | user data to be passed to |
Returns : | the number of faces removed from |
GtsSurfaceTraverse * gts_surface_traverse_new (GtsSurface *s, GtsFace *f);
s : | a GtsSurface. |
f : | a GtsFace belonging to |
Returns : | a new GtsSurfaceTraverse, initialized to start traversing
from face |
GtsFace * gts_surface_traverse_next (GtsSurfaceTraverse *t,guint *level);
t : | |
level : | a pointer to a guint or |
Returns : | the next face of the traversal in breadth-first order or
|
void gts_surface_traverse_destroy (GtsSurfaceTraverse *t);
Frees all the memory allocated for t
.
t : |
void gts_surface_refine (GtsSurface *surface, GtsKeyFunc cost_func,gpointer cost_data, GtsRefineFunc refine_func,gpointer refine_data, GtsStopFunc stop_func,gpointer stop_data);
Refine surface
using a midvertex insertion technique. All the
edges of surface
are ordered according to cost_func
. The edges
are then processed in order until stop_func
returns
If cost_func
is set to
If refine_func
is set to gts_segment_midvertex()
is used.
surface : | a GtsSurface. |
cost_func : | a function returning the cost for a given edge. |
cost_data : | user data to be passed to |
refine_func : | |
refine_data : | user data to be passed to |
stop_func : | a GtsStopFunc. |
stop_data : | user data to be passed to |
void gts_surface_coarsen (GtsSurface *surface, GtsKeyFunc cost_func,gpointer cost_data, GtsCoarsenFunc coarsen_func,gpointer coarsen_data, GtsStopFunc stop_func,gpointer stop_data,gdouble minangle);
The edges of surface
are sorted according to cost_func
to
create a priority heap (a GtsEHeap). The edges are extracted in
turn from the top of the heap and collapsed (i.e. the vertices are
replaced by the vertex returned by the coarsen_func
function)
until the stop_func
functions returns
If cost_func
is set to
If coarsen_func
is set to gts_segment_midvertex()
is used.
The minimum angle is used to avoid introducing faces which would be folded.
surface : | a GtsSurface. |
cost_func : | a function returning the cost for a given edge. |
cost_data : | user data to be passed to |
coarsen_func : | a |
coarsen_data : | user data to be passed to |
stop_func : | a GtsStopFunc. |
stop_data : | user data to be passed to |
minangle : | minimum angle between two neighboring triangles. |
gboolean gts_coarsen_stop_number (gdouble cost,guint nedge,guint *min_number);
This function is to be used as the stop_func
argument of
gts_surface_coarsen()
or gts_psurface_new()
.
cost : | the cost of the edge collapse considered. |
nedge : | the current number of edges of the surface being simplified. |
min_number : | a pointer to the minimum number of edges desired for the surface being simplified. |
Returns : | |
gboolean gts_coarsen_stop_cost (gdouble cost,guint nedge,gdouble *max_cost);
This function is to be used as the stop_func
argument of
gts_surface_coarsen()
or gts_psurface_new()
.
cost : | the cost of the edge collapse considered. |
nedge : | the current number of edges of the surface being simplified. |
max_cost : | a pointer to the maximum cost allowed for an edge collapse. |
Returns : | |
void gts_surface_tessellate (GtsSurface *s, GtsRefineFunc refine_func,gpointer refine_data);
Tessellate each triangle of s
with 4 triangles:
the number of triangles is increased by a factor of 4.
http://mathworld.wolfram.com/GeodesicDome.html
If refine_func
is set to gts_surface_tessellate()
corresponds to a geodesation step
(see gts_surface_generate_sphere()
).
s : | a GtsSurface. |
refine_func : | |
refine_data : | user data to be passed to |
GtsSurface * gts_surface_generate_sphere (GtsSurface *s,guint geodesation_order);
Add a triangulated unit sphere generated by recursive subdivision to s
.
First approximation is an isocahedron; each level of refinement
(geodesation_order
) increases the number of triangles by a factor of 4.
http://mathworld.wolfram.com/GeodesicDome.html
s : | a GtsSurface. |
geodesation_order : | a |
Returns : | |
GtsSurface * gts_surface_copy (GtsSurface *s1, GtsSurface *s2);
Add a copy of all the faces, edges and vertices of s2
to s1
.
s1 : | a GtsSurface. |
s2 : | a GtsSurface. |
Returns : | |
void gts_surface_merge (GtsSurface *s, GtsSurface *with);
Adds all the faces of with
which do not already belong to s
to s
.
s : | a GtsSurface. |
with : | another GtsSurface. |
gboolean gts_surface_is_manifold (GtsSurface *s);
s : | a GtsSurface. |
Returns : | |
gboolean gts_surface_is_closed (GtsSurface *s);
s : | a GtsSurface. |
Returns : | |
gboolean gts_surface_is_orientable (GtsSurface *s);
s : | a GtsSurface. |
Returns : | |
gdouble gts_surface_volume (GtsSurface *s);
s : | a GtsSurface. |
Returns : | the signed volume of the domain bounded by the surface |
gdouble gts_surface_center_of_mass (GtsSurface *s, GtsVector cm);
Fills cm
with the coordinates of the center of mass of s
.
s : | a GtsSurface. |
cm : | a GtsVector. |
Returns : | the signed volume of the domain bounded by the surface |
gdouble gts_surface_center_of_area (GtsSurface *s, GtsVector cm);
Fills cm
with the coordinates of the center of area of s
.
s : | a GtsSurface. |
cm : | a GtsVector. |
Returns : | the area of surface |
guint gts_surface_vertex_number (GtsSurface *s);
s : | a GtsSurface. |
Returns : | the number of vertices of |
guint gts_surface_edge_number (GtsSurface *s);
s : | a GtsSurface. |
Returns : | the number of edges of |
guint gts_surface_face_number (GtsSurface *s);
s : | a GtsSurface. |
Returns : | the number of faces of |
void gts_surface_distance (GtsSurface *s1, GtsSurface *s2,gdouble delta, GtsRange *face_range, GtsRange *boundary_range);
Using the gts_bb_tree_surface_distance()
and
gts_bb_tree_surface_boundary_distance()
functions fills face_range
and boundary_range
with the min, max and average Euclidean
(minimum) distances between the faces of s1
and the faces of s2
and between the boundary edges of s1
and s2
.
s1 : | a GtsSurface. |
s2 : | a GtsSurface. |
delta : | a spatial increment defined as the percentage of the diagonal
of the bounding box of |
face_range : | a GtsRange. |
boundary_range : | a GtsRange. |
GSList * gts_surface_boundary (GtsSurface *surface);
surface : | a GtsSurface. |
Returns : | a list of GtsEdge boundary of |
GSList * gts_surface_split (GtsSurface *s);
Splits a surface into connected and manifold components.
s : | a GtsSurface. |
Returns : | a list of new GtsSurface. |
gboolean gts_vertex_mean_curvature_normal (GtsVertex *v, GtsSurface *s, GtsVector Kh);
Computes the Discrete Mean Curvature Normal approximation at v
.
The mean curvature at v
is half the magnitude of the vector Kh
.
Note: the normal computed is not unit length, and may point either
into or out of the surface, depending on the curvature at v
. It
is the responsibility of the caller of the function to use the mean
curvature normal appropriately.
This approximation is from the paper: Discrete Differential-Geometry Operators for Triangulated 2-Manifolds Mark Meyer, Mathieu Desbrun, Peter Schroder, Alan H. Barr VisMath '02, Berlin (Germany) http://www-grail.usc.edu/pubs.html
v : | a GtsVertex. |
s : | a GtsSurface. |
Kh : | the Mean Curvature Normal at |
Returns : | |
gboolean gts_vertex_gaussian_curvature (GtsVertex *v, GtsSurface *s,gdouble *Kg);
Computes the Discrete Gaussian Curvature approximation at v
.
This approximation is from the paper: Discrete Differential-Geometry Operators for Triangulated 2-Manifolds Mark Meyer, Mathieu Desbrun, Peter Schroder, Alan H. Barr VisMath '02, Berlin (Germany) http://www-grail.usc.edu/pubs.html
v : | a GtsVertex. |
s : | a GtsSurface. |
Kg : | the Discrete Gaussian Curvature approximation at |
Returns : | |
void gts_vertex_principal_curvatures (gdouble Kh,gdouble Kg,gdouble *K1,gdouble *K2);
Computes the principal curvatures at a point given the mean and Gaussian curvatures at that point.
The mean curvature can be computed as one-half the magnitude of the
vector computed by gts_vertex_mean_curvature_normal()
.
The Gaussian curvature can be computed with
gts_vertex_gaussian_curvature()
.
Kh : | mean curvature. |
Kg : | Gaussian curvature. |
K1 : | first principal curvature. |
K2 : | second principal curvature. |
void gts_vertex_principal_directions (GtsVertex *v, GtsSurface *s, GtsVector Kh,gdouble Kg, GtsVector e1, GtsVector e2);
Computes the principal curvature directions at a point given Kh
and Kg
, the mean curvature normal and Gaussian curvatures at that
point, computed with gts_vertex_mean_curvature_normal()
and
gts_vertex_gaussian_curvature()
, respectively.
Note that this computation is very approximate and tends to be unstable. Smoothing of the surface or the principal directions may be necessary to achieve reasonable results.
v : | a GtsVertex. |
s : | a GtsSurface. |
Kh : | mean curvature normal (a GtsVector). |
Kg : | Gaussian curvature (a gdouble). |
e1 : | first principal curvature direction (direction of largest curvature). |
e2 : | second principal curvature direction. |
typedef struct { gdouble volume_weight; gdouble boundary_weight; gdouble shape_weight; } GtsVolumeOptimizedParams;
GtsVertex * gts_volume_optimized_vertex (GtsEdge *edge,GtsVertexClass *klass, GtsVolumeOptimizedParams *params);
edge : | a GtsEdge. |
klass : | a |
params : | a |
Returns : | a GtsVertex which can be used to replace |
gdouble gts_volume_optimized_cost (GtsEdge *e, GtsVolumeOptimizedParams *params);
e : | a GtsEdge. |
params : | |
Returns : | the cost for the collapse of |
GSList * gts_surface_intersection (GtsSurface *s1, GtsSurface *s2,GNode *faces_tree1,GNode *faces_tree2);
s1 : | a GtsSurface. |
s2 : | a GtsSurface. |
faces_tree1 : | a bounding box tree (see |
faces_tree2 : | a bounding box tree for the faces of |
Returns : | a list of GtsEdge defining the curve intersection of the two surfaces. |
typedef enum { GTS_1_OUT_2, GTS_1_IN_2, GTS_2_OUT_1, GTS_2_IN_1 } GtsBooleanOperation;
GTS_1_OUT_2 | identifies the part of the first surface which lies outside the second surface. |
GTS_1_IN_2 | identifies the part of the first surface which lies inside the second surface. |
GTS_2_OUT_1 | identifies the part of the second surface which lies outside the first surface. |
GTS_2_IN_1 | identifies the part of the second surface which lies inside the first surface. |
#define GTS_IS_SURFACE_INTER(obj)
Evaluates to obj
is a GtsSurfaceInter,
obj : | a GtsObject. |
#define GTS_SURFACE_INTER(obj)
Casts obj
to GtsSurfaceInter.
obj : | a descendant of GtsSurfaceInter. |
#define GTS_SURFACE_INTER_CLASS(klass)
Casts klass
to
klass : | a descendant of |
typedef struct { GtsObject object; GtsSurface * s1; GtsSurface * s2; GSList * edges; } GtsSurfaceInter;
GtsSurfaceInterClass * gts_surface_inter_class (void);
Returns : | the |
GtsSurfaceInter * gts_surface_inter_new (GtsSurfaceInterClass *klass, GtsSurface *s1, GtsSurface *s2,GNode *faces_tree1,GNode *faces_tree2,gboolean is_open1,gboolean is_open2);
When triangulating the cut faces, the new faces inherit the
attributes of these original faces through their attributes()
klass : | a |
s1 : | a GtsSurface. |
s2 : | a GtsSurface. |
faces_tree1 : | a bounding box tree (see |
faces_tree2 : | a bounding box tree for the faces of |
is_open1 : | whether |
is_open2 : | whether |
Returns : | a new GtsSurfaceInter describing the intersection of |
gboolean gts_surface_inter_check (GtsSurfaceInter *si,gboolean *closed);
si : | |
closed : | is set to |
Returns : | |
void gts_surface_inter_boolean (GtsSurfaceInter *si, GtsSurface *surface, GtsBooleanOperation op);
Adds to surface
the part of the surface described by si
and op
.
si : | |
surface : | a GtsSurface. |
op : |
gboolean gts_surface_foreach_intersecting_face (GtsSurface *s, GtsBBTreeTraverseFunc func,gpointer data);
Calls func
for each intersecting pair of faces of s
.
s : | a GtsSurface. |
func : | |
data : | user data to pass to |
Returns : | |
GtsSurface * gts_surface_is_self_intersecting (GtsSurface *s);
s : | a GtsSurface. |
Returns : | a new GtsSurface containing the faces of |
GtsHeap * gts_heap_new (GCompareFunc compare_func);
compare_func : | a GCompareFunc. |
Returns : | a new GtsHeap using |
void gts_heap_insert (GtsHeap *heap,gpointer p);
Inserts a new element p
in the heap.
heap : | a GtsHeap. |
p : | a pointer to add to the heap. |
gpointer gts_heap_remove_top (GtsHeap *heap);
Removes the element at the top of the heap.
heap : | a GtsHeap. |
Returns : | the element at the top of the heap. |
gpointer gts_heap_top (GtsHeap *heap);
heap : | a GtsHeap. |
Returns : | the element at the top of the heap. |
void gts_heap_thaw (GtsHeap *heap);
If heap
has been frozen previously using gts_heap_freeze()
, reorder it
in O(n) time and unfreeze it.
heap : | a GtsHeap. |
void gts_heap_foreach (GtsHeap *heap,GFunc func,gpointer user_data);
heap : | a GtsHeap. |
func : | the function to call for each element in the heap. |
user_data : | to pass to |
void gts_heap_freeze (GtsHeap *heap);
Freezes the heap. Any subsequent operation will not preserve the heap
property. Used in conjunction with gts_heap_insert()
and gts_heap_thaw()
to create a heap in O(n) time.
heap : | a GtsHeap. |
guint gts_heap_size (GtsHeap *heap);
heap : | a GtsHeap. |
Returns : | the number of items in |
void gts_heap_destroy (GtsHeap *heap);
Free all the memory allocated for heap
.
heap : | a GtsHeap. |
GtsEHeap * gts_eheap_new (GtsKeyFunc key_func,gpointer data);
key_func : | a GtsKeyFunc or |
data : | user data to be passed to |
Returns : | a new GtsEHeap using |
GtsEHeapPair * gts_eheap_insert (GtsEHeap *heap,gpointer p);
Inserts a new element p
in the heap.
heap : | a GtsEHeap. |
p : | a pointer to add to the heap. |
Returns : | a GtsEHeapPair describing the position of the element in the heap.
This pointer is necessary for |
GtsEHeapPair * gts_eheap_insert_with_key (GtsEHeap *heap,gpointer p,gdouble key);
Inserts a new element p
in the heap.
heap : | a GtsEHeap. |
p : | a pointer to add to the heap. |
key : | the value of the key associated to |
Returns : | a GtsEHeapPair describing the position of the element in the heap.
This pointer is necessary for |
gpointer gts_eheap_remove_top (GtsEHeap *heap,gdouble *key);
Removes the element at the top of the heap and optionally (if key
is not
heap : | a GtsEHeap. |
key : | a pointer on a gdouble or |
Returns : | the element at the top of the heap. |
gpointer gts_eheap_top (GtsEHeap *heap,gdouble *key);
heap : | a GtsEHeap. |
key : | a pointer on a gdouble or |
Returns : | the element at the top of the heap and optionally (if |
void gts_eheap_thaw (GtsEHeap *heap);
If heap
has been frozen previously using gts_eheap_freeze()
, reorder it
in O(n) time and unfreeze it.
heap : | a GtsEHeap. |
void gts_eheap_foreach (GtsEHeap *heap,GFunc func,gpointer data);
heap : | a GtsEHeap. |
func : | the function to call for each element in the heap. |
data : | to pass to |
gpointer gts_eheap_remove (GtsEHeap *heap, GtsEHeapPair *p);
Removes element corresponding to p
from heap
in O(log n).
heap : | a GtsEHeap. |
p : | a GtsEHeapPair. |
Returns : | the element just removed from |
void gts_eheap_decrease_key (GtsEHeap *heap, GtsEHeapPair *p,gdouble new_key);
Decreases the value of the key of the element at position p
.
heap : | a GtsEHeap. |
p : | a GtsEHeapPair. |
new_key : | the new value of the key for this element. Must be smaller than the current key. |
void gts_eheap_freeze (GtsEHeap *heap);
Freezes the heap. Any subsequent operation will not preserve the heap
property. Used in conjunction with gts_eheap_insert()
and gts_eheap_thaw()
to create a heap in O(n) time.
heap : | a GtsEHeap. |
guint gts_eheap_size (GtsEHeap *heap);
heap : | a GtsEHeap. |
Returns : | the number of items in |
void gts_eheap_update (GtsEHeap *heap);
Updates the key of each element of heap
and reorders it.
heap : | a GtsEHeap. |
gdouble gts_eheap_key (GtsEHeap *heap,gpointer p);
heap : | a GtsEHeap. |
p : | a pointer to be tested; |
Returns : | the value of the key for pointer |
void gts_eheap_randomized (GtsEHeap *heap,gboolean randomized);
heap : | a GtsEHeap. |
randomized : | whether |
void gts_eheap_destroy (GtsEHeap *heap);
Free all the memory allocated for heap
.
heap : | a GtsEHeap. |
void gts_fifo_write (GtsFifo *fifo,FILE *fp);
Writes the content of fifo
in fp
.
fifo : | a GtsFifo. |
fp : | a file pointer. |
void gts_fifo_push (GtsFifo *fifo,gpointer data);
Push data
into fifo
.
fifo : | a GtsFifo. |
data : | data to add to |
gpointer gts_fifo_pop (GtsFifo *fifo);
Removes the first element from fifo
.
fifo : | a GtsFifo. |
Returns : | the first element in |
gpointer gts_fifo_top (GtsFifo *fifo);
fifo : | a GtsFifo. |
Returns : | the first element in |
guint gts_fifo_size (GtsFifo *fifo);
fifo : | a GtsFifo. |
Returns : | the number of elements in |
gboolean gts_fifo_is_empty (GtsFifo *fifo);
fifo : | a GtsFifo. |
Returns : | |
void gts_fifo_foreach (GtsFifo *fifo, GtsFunc func,gpointer data);
Calls func
in order for each item in fifo
, passing data
.
fifo : | a GtsFifo. |
func : | a GtsFunc. |
data : | user data to be passed to |
void gts_fifo_reverse (GtsFifo *fifo);
Reverses the order of elements in fifo
.
fifo : | a GtsFifo. |
void gts_fifo_destroy (GtsFifo *fifo);
Frees all the memory allocated for fifo
.
fifo : | a GtsFifo. |
typedef struct { GtsObject object; GtsVertex * v; GtsObject * v1; GtsObject * v2; GtsSplitCFace * cfaces; guint ncf; } GtsSplit;
GtsSplit * gts_split_new (GtsSplitClass *klass, GtsVertex *v, GtsObject *o1, GtsObject *o2);
Creates a new GtsSplit which would collapse o1
and o2
into v
. The
collapse itself is not performed.
klass : | a |
v : | a GtsVertex. |
o1 : | |
o2 : | |
Returns : | the new GtsSplit. |
void gts_split_collapse (GtsSplit *vs,GtsEdgeClass *klass, GtsEHeap *heap);
Collapses the vertex split vs
. Any new edge created during the process will
be of class klass
. If heap is not
vs : | a GtsSplit. |
klass : | a |
heap : | a GtsEHeap or |
void gts_split_expand (GtsSplit *vs, GtsSurface *s,GtsEdgeClass *klass);
Expands the vertex split vs
adding the newly created faces to s
. Any
new edge will be of class klass
.
vs : | a GtsSplit. |
s : | a GtsSurface. |
klass : | a |
gboolean (*GtsSplitTraverseFunc) (GtsSplit *vs,gpointer data);
vs : | |
data : | |
Returns : |
void gts_split_traverse (GtsSplit *root,GTraverseType order,gint depth, GtsSplitTraverseFunc func,gpointer data);
Traverses the GtsSplit tree having root
as root. Calls func
for each
GtsSplit of the tree in the order specified by order
. If order is set
to G_PRE_ORDER func
is called for the GtsSplit then its children, if order
is set to G_POST_ORDER func
is called for the children and then for the
GtsSplit.
root : | the GtsSplit to start the traversal from. |
order : | the order in which nodes are visited - G_PRE_ORDER or G_POST_ORDER. |
depth : | the maximum depth of the traversal. Nodes below this depth will not be visited. If depth is -1 all nodes in the tree are visited. If depth is 1, only the root is visited. If depth is 2, the root and its children are visited. And so on. |
func : | the function to call for each visited GtsHSplit. |
data : | user data to pass to the function. |
guint gts_split_height (GtsSplit *root);
root : | a GtsSplit. |
Returns : | the maximum height of the vertex split tree having |
typedef struct { GtsObject object; GtsSurface * s; GPtrArray * split; GtsSplitClass * split_class; guint pos, min; GPtrArray * vertices; GPtrArray * faces; } GtsPSurface;
GtsPSurface * gts_psurface_new (GtsPSurfaceClass *klass, GtsSurface *surface,GtsSplitClass *split_class, GtsKeyFunc cost_func,gpointer cost_data, GtsCoarsenFunc coarsen_func,gpointer coarsen_data, GtsStopFunc stop_func,gpointer stop_data,gdouble minangle);
This function works in exactly the same way as the
gts_surface_coarsen()
function, except that the history of edge
collapse is saved in an array of GtsSplit objects. This allows for
dynamic continuous multiresolution control of the input surface
.
klass : | a |
surface : | a GtsSurface. |
split_class : | a |
cost_func : | cost function for the edge collapse algorithm. |
cost_data : | data to pass to |
coarsen_func : | the function returning the vertex replacement for the edge collapse. |
coarsen_data : | data to pass to |
stop_func : | the function to call to decide whether to stop the coarsening process. |
stop_data : | data to pass to |
minangle : | the minimum angle allowable between two neighboring triangles. This is used to avoid introducing folds in the mesh during simplification. |
Returns : | a new progressive surface. |
GtsSplit * gts_psurface_add_vertex (GtsPSurface *ps);
Adds a vertex to the progressive surface ps
by expanding the next
available GtsSplit.
ps : | a GtsPSurface. |
Returns : | the expanded GtsSplit or |
GtsSplit * gts_psurface_remove_vertex (GtsPSurface *ps);
Removes one vertex from the progressive surface ps
by collapsing the first
available GtsSplit.
ps : | a GtsPSurface. |
Returns : | the collapsed GtsSplit or |
guint gts_psurface_max_vertex_number (GtsPSurface *ps);
ps : | a GtsPSurface. |
Returns : | the maximum number of vertices of |
guint gts_psurface_min_vertex_number (GtsPSurface *ps);
ps : | a GtsPSurface. |
Returns : | the minimum number of vertices of |
void gts_psurface_set_vertex_number (GtsPSurface *ps,guint n);
Performs the required number of collapses or expansions to set the number
of vertices of ps
to n
.
ps : | a GtsPSurface. |
n : | a number of vertices. |
guint gts_psurface_get_vertex_number (GtsPSurface *ps);
ps : | a GtsPSurface. |
Returns : | the current number of vertices of |
void gts_psurface_write (GtsPSurface *ps,FILE *fptr);
Writes to fptr
a GTS progressive surface description.
ps : | a GtsPSurface. |
fptr : | a file pointer. |
GtsPSurface * gts_psurface_open (GtsPSurfaceClass *klass, GtsSurface *s,GtsSplitClass *split_class, GtsFile *f);
Creates a new GtsPSurface prepared for input from the file f
containing a valid GTS representation of a progressive surface. The initial
shape of the progressive surface is loaded into s
.
Before being usable as such this progressive surface must be closed using
gts_psurface_close()
. While open however, the functions
gts_psurface_get_vertex_number()
, gts_psurface_min_vertex_number()
and
gts_psurface_max_vertex_number()
can still be used.
klass : | a |
s : | a GtsSurface. |
split_class : | a |
f : | a GtsFile. |
Returns : | a new GtsPSurface or |
GtsSplit * gts_psurface_read_vertex (GtsPSurface *ps, GtsFile *fp);
Reads in one vertex split operation from fp
and performs the expansion.
If an error occurs while reading the file, the error
field of fp
is set.
ps : | a GtsPSurface prealably created with |
fp : | a GtsFile. |
Returns : | the newly created GtsSplit or |
void gts_psurface_close (GtsPSurface *ps);
Closes a progressive surface.
ps : | a GtsPSurface prealably created with |
void gts_psurface_foreach_vertex (GtsPSurface *ps, GtsFunc func,gpointer data);
Calls func
for each (potential) vertex of ps
, whether actually used
or not. The vertices are called in the order they were created during the
edge collapse operation.
ps : | a GtsPSurface. |
func : | a function to call for each vertex of |
data : | data to be passed to |
typedef struct { GtsSplit split; GtsEHeapPair * index; GtsHSplit * parent; guint nchild; } GtsHSplit;
GtsHSplit * gts_hsplit_new (GtsHSplitClass *klass, GtsSplit *vs);
klass : | a |
vs : | a GtsSplit. |
Returns : | a new GtsHSplit, hierarchical extension of |
void gts_hsplit_collapse (GtsHSplit *hs, GtsHSurface *hsurface);
Collapses the GtsSplit defined by hs
, updates the expandable and
collapsable priority heaps of hsurface
.
hs : | a GtsHSplit. |
hsurface : | a GtsHSurface. |
void gts_hsplit_expand (GtsHSplit *hs, GtsHSurface *hsurface);
Expands the GtsSplit defined by hs
(which must be expandable)
and updates the priority heaps of hsurface
.
hs : | a GtsHSplit. |
hsurface : | a GtsHSurface. |
void gts_hsplit_force_expand (GtsHSplit *hs, GtsHSurface *hsurface);
Forces the expansion of hs
by first expanding all its dependencies not
already expanded.
hs : | a GtsHSplit. |
hsurface : | a GtsHSurface. |
typedef struct { GtsObject object; GtsSurface * s; GSList * roots; GtsEHeap * expandable; GtsEHeap * collapsable; GPtrArray * split; guint nvertex; } GtsHSurface;
GtsHSurface * gts_hsurface_new (GtsHSurfaceClass *klass,GtsHSplitClass *hsplit_class, GtsPSurface *psurface, GtsKeyFunc expand_key,gpointer expand_data, GtsKeyFunc collapse_key,gpointer collapse_data);
klass : | a |
hsplit_class : | a |
psurface : | a GtsPSurface. |
expand_key : | a GtsKeyFunc used to order the priority heap of expandable GtsHSplit. |
expand_data : | data to be passed to |
collapse_key : | a GtsKeyFunc used to order the priority heap of collapsable GtsHSplit. |
collapse_data : | data to be passed to |
Returns : | a new GtsHSurface, hierarchical extension of |
void gts_hsurface_traverse (GtsHSurface *hsurface,GTraverseType order,gint depth, GtsSplitTraverseFunc func,gpointer data);
Traverses a hierarchical surface starting from its roots. It calls
the given function for each GtsHSplit visited.
See also gts_split_traverse()
.
hsurface : | a GtsHSurface. |
order : | the order in which nodes are visited - G_PRE_ORDER or G_POST_ORDER. |
depth : | the maximum depth of the traversal. Nodes below this depth will not be visited. If max_depth is -1 all nodes in the tree are visited. If depth is 1, only the root is visited. If depth is 2, the root and its children are visited. And so on. |
func : | the function to call for each visited GtsHSplit. |
data : | user data to pass to the function. |
void gts_hsurface_foreach (GtsHSurface *hsurface,GTraverseType order, GtsFunc func,gpointer data);
Starts by expanding all the GtsHSplit of hsurface
. If order
is
G_PRE_ORDER, calls func
for each GtsHSplit and collapses it. If
order is G_POST_ORDER, collapses each GtsHSplit first and then
calls func
. The traversal can be halted at any point by returning
TRUE from func.
hsurface : | a GtsHSurface. |
order : | the order in which GtsHSplit are visited - G_PRE_ORDER or G_POST_ORDER. |
func : | the function to call for each visited GtsHSplit. |
data : | user data to pass to the function. |
guint gts_hsurface_height (GtsHSurface *hsurface);
hsurface : | a GtsHSurface. |
Returns : | the maximum height of the tree described by |
#define GTS_IS_CONSTRAINT(obj)
Evaluates to obj
is a GtsConstraint,
obj : | a GtsObject. |
#define GTS_CONSTRAINT(obj)
Casts obj
to GtsConstraint.
obj : | a descendant of GtsConstraint. |
#define GTS_CONSTRAINT_CLASS(klass)
Casts klass
to GtsConstraintClass.
klass : | a desscendant of GtsConstraintClass. |
GtsConstraintClass * gts_constraint_class (void);
Returns : | the GtsConstraintClass. |
GtsFace * gts_point_locate (GtsPoint *p, GtsSurface *surface, GtsFace *guess);
Locates the face of the planar projection of surface
containing
p
. The planar projection of surface
must define a connected set
of triangles without holes and bounded by a convex boundary. The
algorithm is randomized and performs in O(n^1/3) expected time
where n is the number of triangles of surface
.
If a good guess
is given the point location can be significantly faster.
p : | a GtsPoint. |
surface : | a GtsSurface. |
guess : | |
Returns : | a GtsFace of |
GtsVertex * gts_delaunay_add_vertex_to_face (GtsSurface *surface, GtsVertex *v, GtsFace *f);
Adds vertex v
to the face f
of the Delaunay triangulation defined
by surface
.
surface : | a GtsSurface. |
v : | a GtsVertex. |
f : | a GtsFace belonging to |
Returns : | |
GtsVertex * gts_delaunay_add_vertex (GtsSurface *surface, GtsVertex *v, GtsFace *guess);
Adds vertex v
to the Delaunay triangulation defined by
surface
. If v
is not contained in the convex hull bounding
surface
, v
is not added to the triangulation.
surface : | a GtsSurface. |
v : | a GtsVertex. |
guess : | |
Returns : | |
void gts_delaunay_remove_vertex (GtsSurface *surface, GtsVertex *v);
Removes v
from the Delaunay triangulation defined by surface
and
restores the Delaunay property. Vertex v
must not be used by any
constrained edge otherwise the triangulation is not guaranteed to
be Delaunay.
surface : | a GtsSurface. |
v : | a GtsVertex. |
GtsFace * gts_delaunay_check (GtsSurface *surface);
surface : | a GtsSurface. |
Returns : | |
GSList * gts_delaunay_add_constraint (GtsSurface *surface, GtsConstraint *c);
Add constraint c
to the constrained Delaunay triangulation defined by
surface
.
surface : | a GtsSurface. |
c : | |
Returns : | a list of GtsConstraint conflicting (i.e. intersecting) with |
void gts_delaunay_remove_hull (GtsSurface *surface);
Removes all the edges of the boundary of surface
which are not
constraints.
surface : | a GtsSurface. |
gboolean (*GtsEncroachFunc) (GtsVertex *v, GtsEdge *e, GtsSurface *s,gpointer data);
v : | |
e : | |
s : | |
data : | |
Returns : |
gboolean gts_vertex_encroaches_edge (GtsVertex *v, GtsEdge *e);
v : | a GtsVertex. |
e : | a GtsEdge. |
Returns : | |
GtsVertex * gts_edge_is_encroached (GtsEdge *e, GtsSurface *s, GtsEncroachFunc encroaches,gpointer data);
e : | a GtsEdge. |
s : | a GtsSurface describing a (constrained) Delaunay triangulation. |
encroaches : | |
data : | user data to be passed to |
Returns : | a GtsVertex belonging to |
guint gts_delaunay_conform (GtsSurface *surface,gint steiner_max, GtsEncroachFunc encroaches,gpointer data);
Recursively split constraints of surface
which are encroached by
vertices of surface
(see Shewchuk 96 for details). The split
constraints are destroyed and replaced by a set of new constraints
of the same class. If gts_vertex_encroaches_edge()
is used for
encroaches
, the resulting surface will be Delaunay conforming.
If steiner_max
is positive or nul, the recursive splitting
procedure will stop when this maximum number of Steiner points is
reached. In that case the resulting surface will not necessarily be
Delaunay conforming.
surface : | a GtsSurface describing a constrained Delaunay triangulation. |
steiner_max : | maximum number of Steiner points. |
encroaches : | |
data : | user-data to pass to |
Returns : | the number of remaining encroached edges. If |
guint gts_delaunay_refine (GtsSurface *surface,gint steiner_max, GtsEncroachFunc encroaches,gpointer encroach_data, GtsKeyFunc cost,gpointer cost_data);
An implementation of the refinement algorithm described in Ruppert (1995) and Shewchuk (1996).
surface : | a GtsSurface describing a conforming Delaunay triangulation. |
steiner_max : | maximum number of Steiner points. |
encroaches : | |
encroach_data : | user-data to pass to |
cost : | a GtsKeyFunc used to sort the faces during refinement. |
cost_data : | user-data to pass to |
Returns : | the number of unrefined faces of |
void (*GtsIsoCartesianFunc) (gdouble **a, GtsCartesianGrid g,guint i,gpointer data);
a : | |
g : | |
i : | |
data : |
GtsIsoSlice * gts_iso_slice_new (guint nx,guint ny);
nx : | number of vertices in the x direction. |
ny : | number of vertices in the y direction. |
Returns : | a new GtsIsoSlice. |
void gts_iso_slice_fill (GtsIsoSlice *slice, GtsGridPlane *plane1, GtsGridPlane *plane2,gdouble **f1,gdouble **f2,gdouble iso,GtsVertexClass *klass);
Fill slice
with the coordinates of the vertices defined by
f1 (x,y,z) = iso
and f2 (x, y, z) = iso
.
slice : | a GtsIsoSlice. |
plane1 : | a GtsGridPlane. |
plane2 : | another GtsGridPlane. |
f1 : | values of the function corresponding to |
f2 : | values of the function corresponding to |
iso : | isosurface value. |
klass : | a |
void gts_iso_slice_fill_cartesian (GtsIsoSlice *slice, GtsCartesianGrid g,gdouble **f1,gdouble **f2,gdouble iso,GtsVertexClass *klass);
Fill slice
with the coordinates of the vertices defined by
f1 (x,y,z) = iso
and f2 (x, y, z) = iso
.
slice : | a GtsIsoSlice. |
g : | |
f1 : | values of the function for plane z = |
f2 : | values of the function for plane z = |
iso : | isosurface value. |
klass : | a |
void gts_iso_slice_destroy (GtsIsoSlice *slice);
Free all memory allocated for slice
.
slice : | a GtsIsoSlice. |
void gts_isosurface_slice (GtsIsoSlice *slice1, GtsIsoSlice *slice2, GtsSurface *surface);
Given two successive slices slice1
and slice2
link their vertices with
segments and triangles which are added to surface
.
slice1 : | a GtsIsoSlice. |
slice2 : | another GtsIsoSlice. |
surface : | a GtsSurface. |
void gts_isosurface_cartesian (GtsSurface *surface, GtsCartesianGrid g, GtsIsoCartesianFunc f,gpointer data,gdouble iso);
Adds to surface
new faces defining the isosurface f(x,y,z) = iso
. By
convention, the normals to the surface are pointing toward the positive
values of f(x,y,z) - iso
.
The user function f
is called successively for each value of the z
coordinate defined by g
. It must fill the corresponding (x,y) plane with
the values of the function for which the isosurface is to be computed.
surface : | a GtsSurface. |
g : | |
f : | |
data : | user data to be passed to |
iso : | isosurface value. |
void gts_isosurface_tetra (GtsSurface *surface, GtsCartesianGrid g, GtsIsoCartesianFunc f,gpointer data,gdouble iso);
Adds to surface
new faces defining the isosurface f(x,y,z) =
iso
. By convention, the normals to the surface are pointing toward
the positive values of f(x,y,z) - iso
.
The user function f
is called successively for each value of the z
coordinate defined by g
. It must fill the corresponding (x,y)
plane with the values of the function for which the isosurface is
to be computed.
surface : | a GtsSurface. |
g : | |
f : | |
data : | user data to be passed to |
iso : | isosurface value. |
void gts_isosurface_tetra_bcl (GtsSurface *surface, GtsCartesianGrid g, GtsIsoCartesianFunc f,gpointer data,gdouble iso);
Adds to surface
new faces defining the isosurface f(x,y,z) =
iso
. By convention, the normals to the surface are pointing toward
the positive values of f(x,y,z) - iso
.
The user function f
is called successively for each value of the z
coordinate defined by g
. It must fill the corresponding (x,y)
plane with the values of the function for which the isosurface is
to be computed.
This version produces the dual "body-centered" faces relative to
the faces produced by gts_isosurface_tetra()
.
surface : | a GtsSurface. |
g : | |
f : | |
data : | user data to be passed to |
iso : | isosurface value. |
void gts_isosurface_tetra_bounded (GtsSurface *surface, GtsCartesianGrid g, GtsIsoCartesianFunc f,gpointer data,gdouble iso);
Adds to surface
new faces defining the isosurface f(x,y,z) =
iso
. By convention, the normals to the surface are pointing toward
the positive values of f(x,y,z) - iso
. To ensure a closed object,
a boundary of G_MINDOUBLE is added around the domain
The user function f
is called successively for each value of the z
coordinate defined by g
. It must fill the corresponding (x,y)
plane with the values of the function for which the isosurface is
to be computed.
surface : | a GtsSurface. |
g : | |
f : | |
data : | user data to be passed to |
iso : | isosurface value. |
GtsCluster * gts_cluster_new (GtsClusterClass *klass, GtsClusterId id,GtsVertexClass *vklass);
klass : | a |
id : | the id of the new cluster. |
vklass : | a |
Returns : | a new GtsCluster. |
void gts_cluster_add (GtsCluster *c, GtsPoint *p,gpointer data);
Adds point p
to cluster c
.
c : | a GtsCluster. |
p : | a GtsPoint. |
data : | data to pass to the |
void gts_cluster_update (GtsCluster *c);
Updates the position of the vertex representative of all the
vertices added to c
.
c : | a GtsCluster. |
typedef struct { GtsObject parent; GtsSurface * surface; GtsBBox * bbox; GtsVector size; GtsClusterClass * cluster_class; GHashTable * clusters; } GtsClusterGrid;
GtsClusterGridClass * gts_cluster_grid_class (void);
Returns : | the |
GtsClusterGrid * gts_cluster_grid_new (GtsClusterGridClass *klass,GtsClusterClass *cluster_class, GtsSurface *s, GtsBBox *bbox,gdouble delta);
klass : | a |
cluster_class : | the klass to be used for the vertex clusters. |
s : | the simplified surface. |
bbox : | bounding box of the surface to be simplified. |
delta : | the size of one grid cell of the simplification grid. |
Returns : | a new GtsClusterGrid. |
void gts_cluster_grid_add_triangle (GtsClusterGrid *cluster_grid, GtsPoint *p1, GtsPoint *p2, GtsPoint *p3,gpointer data);
Adds the triangle defined by p1
, p2
and p3
to the respective clusters
of cluster_grid
.
cluster_grid : | |
p1 : | a GtsPoint. |
p2 : | a GtsPoint. |
p3 : | a GtsPoint. |
data : | user data to pass to the cluster |
GtsRange gts_cluster_grid_update (GtsClusterGrid *cluster_grid);
Updates the representative vertices of all the clusters of cluster_grid
.
cluster_grid : | |
Returns : | a GtsRange describing the statistics for the number of vertices
added to each cluster of |
GSList * gts_surface_strip (GtsSurface *s);
Decompose s
into triangle strips for fast-rendering.
s : | a GtsSurface. |
Returns : | a list of triangle strips containing all the triangles of |
gboolean gts_containee_is_contained (GtsContainee *item, GtsContainer *c);
item : | |
c : | |
Returns : |
void gts_containee_replace (GtsContainee *item, GtsContainee *with);
item : | |
with : |
void gts_container_foreach (GtsContainer *c, GtsFunc func,gpointer data);
c : | |
func : | |
data : |
typedef struct { GtsContainer c; GHashTable * items; gboolean frozen; } GtsHashContainer;
typedef struct { GtsContainer c; GSList * items; gboolean frozen; } GtsSListContainer;
#define GTS_GNODE_NEIGHBOR(n,e) (GTS_GEDGE (e)->n1 == n ? GTS_GEDGE (e)->n2 : GTS_GEDGE (e)->n2 == n ? GTS_GEDGE (e)->n1 : NULL)
n : | |
e : |
GtsGNode * gts_gnode_new (GtsGNodeClass *klass);
klass : | a |
Returns : | a new GtsGNode. |
void gts_gnode_foreach_neighbor (GtsGNode *n, GtsGraph *g, GtsFunc func,gpointer data);
Calls func
for each neighbor GtsGNode of n
(belonging to g
if
g
is not
n : | a GtsGNode. |
g : | a GtsGraph or |
func : | a GtsFunc. |
data : | user data to be passed to |
void gts_gnode_foreach_edge (GtsGNode *n, GtsGraph *g, GtsFunc func,gpointer data);
Calls func
for each GtsGEdge connecting n
to another GtsGNode
(belonging to g
if g
is not
n : | a GtsGNode. |
g : | a GtsGraph or |
func : | a GtsFunc. |
data : | user data to be passed to |
guint gts_gnode_degree (GtsGNode *n, GtsGraph *g);
n : | a GtsGNode. |
g : | a GtsGraph or |
Returns : | the number of neighbors of |
gfloat gts_gnode_move_cost (GtsGNode *n, GtsGraph *src, GtsGraph *dst);
n : | a GtsGNode. |
src : | a GtsGraph containing |
dst : | another GtsGraph. |
Returns : | the cost (increase in the sum of the weights of the edges cut) of
moving |
gfloat gts_gnode_weight (GtsGNode *n);
n : | a GtsGNode. |
Returns : | the weight of |
GtsNGNode * gts_ngnode_new (GtsNGNodeClass *klass,guint id);
klass : | a |
id : | |
Returns : | a new GtsNGNode with identity |
GtsWGNode * gts_wgnode_new (GtsWGNodeClass *klass,gfloat weight);
klass : | a |
weight : | the weight of the GtsWGNode to create. |
Returns : | a new GtsWGNode of weight |
GtsPNode * gts_pnode_new (GtsPNodeClass *klass,gpointer data);
klass : | a |
data : | user data. |
Returns : | a new GtsPNode associated with |
GtsFNode * gts_fnode_new (GtsFNodeClass *klass, GtsFace *f);
klass : | a |
f : | a GtsFace. |
Returns : | a new GtsFNode associated with face |
GtsGEdge * gts_gedge_new (GtsGEdgeClass *klass, GtsGNode *n1, GtsGNode *n2);
klass : | a |
n1 : | a GtsGNode. |
n2 : | another GtsGNode. |
Returns : | a new GtsGEdge linking |
gfloat gts_gedge_weight (GtsGEdge *e);
e : | a GtsGEdge. |
Returns : | the weight of edge |
GtsPGEdge * gts_pgedge_new (GtsPGEdgeClass *klass, GtsGNode *n1, GtsGNode *n2,gpointer data);
klass : | a |
n1 : | a GtsGNode. |
n2 : | another GtsGNode. |
data : | user data. |
Returns : | a new GtsPGEdge associated with |
GtsWGEdge * gts_wgedge_new (GtsWGEdgeClass *klass, GtsGNode *n1, GtsGNode *n2,gfloat weight);
klass : | a |
n1 : | a GtsGNode. |
n2 : | another GtsGNode. |
weight : | the weight of the new edge. |
Returns : | a new GtsWGEdge of weight |
typedef struct { GtsHashContainer object; GtsGraphClass * graph_class; GtsGNodeClass * node_class; GtsGEdgeClass * edge_class; } GtsGraph;
GtsGraph * gts_graph_new (GtsGraphClass *klass,GtsGNodeClass *node_class,GtsGEdgeClass *edge_class);
klass : | a |
node_class : | a |
edge_class : | a |
Returns : | a new GtsGraph using |
void gts_graph_print_stats (GtsGraph *g,FILE *fp);
Writes to fp
a summary of the properties of g
.
g : | a GtsGraph. |
fp : | a file pointer. |
GtsGraphTraverse * gts_graph_traverse_new (GtsGraph *g, GtsGNode *n, GtsTraverseType type,gboolean reinit);
g : | a GtsGraph. |
n : | a GtsGNode belonging to |
type : | the type of traversal. |
reinit : | if |
Returns : | a new GtsGraphTraverse initialized for the traversal of
|
GtsGNode * gts_graph_traverse_next (GtsGraphTraverse *t);
t : | |
Returns : | the next GtsGNode of the traversal defined by |
GtsGNode * gts_graph_traverse_what_next (GtsGraphTraverse *t);
t : | |
Returns : | the next GtsGNode of the traversal defined by |
void gts_graph_traverse_destroy (GtsGraphTraverse *t);
Frees all the memory allocated for t
.
t : |
void gts_graph_foreach_edge (GtsGraph *g, GtsFunc func,gpointer data);
Calls func
for each GtsEdge of g
.
g : | a GtsGraph. |
func : | a GtsFunc. |
data : | user data to be passed to |
gfloat gts_graph_weight (GtsGraph *g);
g : | a GtsGraph. |
Returns : | the weight of graph |
guint gts_graph_distance_sum (GtsGraph *g, GtsGNode *center);
g : | a GtsGraph. |
center : | a GtsGNode of |
Returns : | the sum of the distances between all the other GtsGNode
of |
GtsGNode * gts_graph_farthest (GtsGraph *g,GSList *gnodes);
g : | a GtsGraph. |
gnodes : | a list of GtsGNode belonging to |
Returns : | the GtsGNode belonging to |
guint gts_graph_edges_cut (GtsGraph *g);
g : | a GtsGraph. |
Returns : | the number of edges of |
gfloat gts_graph_edges_cut_weight (GtsGraph *g);
g : | a GtsGraph. |
Returns : | the sum of the weights of the edges of |
void gts_graph_write (GtsGraph *g,FILE *fp);
Writes in the file fp
an ASCII representation of g
. The file
format is as follows.
All the lines beginning with GTS_COMMENTS are ignored. The first line contains two unsigned integers separated by spaces. The first integer is the number of nodes, nn, the second is the number of edges, ne.
Follows nn lines containing node description. Follows ne lines containing the two indices (starting from one) of the nodes of each edge.
The format described above is the least common denominator to all
GTS files. Consistent with an object-oriented approach, the GTS
file format is extensible. Each of the lines of the file can be
extended with user-specific attributes accessible through the
read()
write()
g : | a GtsGraph. |
fp : | a file pointer. |
void gts_graph_write_dot (GtsGraph *g,FILE *fp);
Writes in the file fp
an ASCII representation of g
in the dot format of
AT&T Bell Labs.
g : | a GtsGraph. |
fp : | a file pointer. |
GtsGraph * gts_graph_read (GtsFile *fp);
Reads a graph from a file.
fp : | a GtsFile. |
Returns : | the new GtsGraph or |
guint gts_graph_read_jostle (GtsGraph *g, GtsFile *fp);
Adds to g
the nodes and edges defined in the file pointed to by
fp
. This file must use the Jostle "graph" ASCII format.
The nodes created are of type GtsNGNode and their identities are the
line number at which they appear in fp
.
g : | a GtsGraph. |
fp : | a GtsFile. |
Returns : | 0 if the lecture was successful, the line number at which
an error occured otherwise (in which case the |
gfloat gts_wgraph_weight_max (GtsWGraph *wg);
wg : | a GtsWGraph. |
Returns : | the maximum weight of any vertices belonging to |
GtsGraph * gts_surface_graph_new (GtsGraphClass *klass, GtsSurface *s);
klass : | a |
s : | a GtsSurface. |
Returns : | a new GtsGraph representing the connectivity of the faces
of |
GtsSurface * gts_surface_graph_surface (GtsGraph *surface_graph, GtsSurface *s);
surface_graph : | a GtsGraph using |
s : | a GtsSurface. |
Returns : | a new GtsSurface using the same classes as |
GtsGraph * gts_segments_graph_new (GtsGraphClass *klass,GSList *segments);
klass : | a |
segments : | a list of GtsSegment. |
Returns : | a new GtsGraph representing the connectivity of the segments
in |
typedef struct { GtsObject object; GtsGNode * n; GtsObject * n1; GtsObject * n2; } GtsGNodeSplit;
#define GTS_GNODE_SPLIT_N1(ns) (GTS_IS_GNODE_SPLIT ((ns)->n1) ? GTS_GNODE_SPLIT ((ns)->n1)->n : GTS_GNODE ((ns)->n1))
ns : |
#define GTS_GNODE_SPLIT_N2(ns) (GTS_IS_GNODE_SPLIT ((ns)->n2) ? GTS_GNODE_SPLIT ((ns)->n2)->n : GTS_GNODE ((ns)->n2))
ns : |
GtsGNodeSplitClass * gts_gnode_split_class (void);
Returns : | the |
GtsGNodeSplit * gts_gnode_split_new (GtsGNodeSplitClass *klass, GtsGNode *n, GtsObject *n1, GtsObject *n2);
Creates a new GtsGNodeSplit which would collapse n1
and n2
into
n
. The collapse itself is not performed.
klass : | a |
n : | a GtsGNode. |
n1 : | a GtsGNodeSplit or GtsGNode. |
n2 : | a GtsGNodeSplit or GtsGNode. |
Returns : | the new GtsGNodeSplit. |
void gts_gnode_split_collapse (GtsGNodeSplit *ns, GtsGraph *g,GtsWGEdgeClass *klass);
Collapses the node split ns
. Any new edge created during the
process will be of class klass
.
ns : | |
g : | a GtsGraph. |
klass : | a |
void gts_gnode_split_expand (GtsGNodeSplit *ns, GtsGraph *g);
Expands the node split ns adding the new nodes to g
.
ns : | |
g : | a GtsGraph. |
typedef struct { GtsObject object; GtsGraph * g; GPtrArray * split; GArray * levels; GtsGNodeSplitClass * split_class; GtsWGEdgeClass * edge_class; guint pos, min, level; } GtsPGraph;
GtsPGraph * gts_pgraph_new (GtsPGraphClass *klass, GtsGraph *g,GtsGNodeSplitClass *split_class,GtsWGNodeClass *node_class,GtsWGEdgeClass *edge_class,guint min);
Creates a new multilevel approximation of graph g
. At each level a
maximal matching is created using the Heavy Edge Matching (HEM)
technique of Karypis and Kumar (1997). The newly created nodes are
of type node_class
and their weight is set to the sum of the
weights of their children. The newly created edges are of type
edge_class
and their weight is set to the sum of the weight of the
collapsed edges. The last level is reached when the maximal
matching obtained would lead to a graph with less than min
nodes.
klass : | a |
g : | a GtsGraph. |
split_class : | a |
node_class : | a |
edge_class : | a |
min : | the minimum number of nodes. |
Returns : | the new GtsPGraph containing the multilevel
representation of |
GtsGNodeSplit * gts_pgraph_add_node (GtsPGraph *pg);
Adds one node to the multilevel graph pg
by expanding the next
available GtsGNodeSplit.
pg : | a GtsPGraph. |
Returns : | the expanded GtsGNodeSplit or |
GtsGNodeSplit * gts_pgraph_remove_node (GtsPGraph *pg);
Removes one node from the multilevel graph pg
by collapsing the
first available GtsGNodeSplit.
pg : | a GtsPGraph. |
Returns : | the collapsed GtsGNodeSplit or |
void gts_pgraph_set_node_number (GtsPGraph *pg,guint n);
Performs the required number of collapses or expansions to set the
number of nodes of pg
to n
.
pg : | a GtsPGraph. |
n : | a number of nodes. |
guint gts_pgraph_get_node_number (GtsPGraph *pg);
pg : | a GtsPGraph. |
Returns : | the current number of nodes of |
guint gts_pgraph_min_node_number (GtsPGraph *pg);
pg : | a GtsPGraph. |
Returns : | the minimum number of nodes of |
guint gts_pgraph_max_node_number (GtsPGraph *pg);
pg : | a GtsPGraph. |
Returns : | the maximum number of nodes of |
void gts_pgraph_foreach_node (GtsPGraph *pg, GtsFunc func,gpointer data);
pg : | |
func : | |
data : |
gboolean gts_pgraph_down (GtsPGraph *pg, GtsFunc func,gpointer data);
Performs the required number of expansions to go from the current level to the level immediately below.
If func
is not
pg : | a GtsPGraph. |
func : | a GtsFunc or |
data : | user data to pass to |
Returns : | |
GSList * gts_graph_bubble_partition (GtsGraph *g,guint np,guint niter, GtsFunc step_info,gpointer data);
An implementation of the "bubble partitioning algorithm" of
Diekmann, Preis, Schlimbach and Walshaw (2000). The maximum number
of iteration on the positions of the graph growing seeds is
controlled by niter
.
If not step_info
is called after each iteration on the seeds
positions passing the partition (a GSList) as argument.
g : | a GtsGraph. |
np : | number of partitions. |
niter : | the maximum number of iterations. |
step_info : | a GtsFunc or |
data : | user data to pass to |
Returns : | a list of |
guint gts_graph_partition_edges_cut (GSList *partition);
partition : | a list of |
Returns : | the number of edges cut by the partition. |
gfloat gts_graph_partition_edges_cut_weight (GSList *partition);
partition : | a list of |
Returns : | the total weight of the edges cut by the partition. |
void gts_graph_partition_print_stats (GSList *partition,FILE *fp);
Writes to fp
a summary of the properties of partition
.
partition : | a list of |
fp : | a file pointer. |
gfloat gts_graph_partition_balance (GSList *partition);
partition : | a list of |
Returns : | the difference between the maximum and the minimum weight
of the graphs in |
GSList * gts_graph_partition_clone (GSList *partition);
partition : | a list of |
Returns : | a new partition clone of |
GSList * gts_graph_recursive_bisection (GtsWGraph *wg,guint n,guint ntry,guint mmax,guint nmin,gfloat imbalance);
Calls gts_graph_bisection_new()
recursively in order to obtain a
2^n
partition of wg
.
wg : | a GtsWGraph. |
n : | the number of bisection levels. |
ntry : | the number of tries for the graph growing algorithm. |
mmax : | the number of unsucessful moves for the refinement algorithm. |
nmin : | the minimum number of nodes of the coarsest graph. |
imbalance : | the maximum relative imbalance allowed between the weights of both halves of the partition. |
Returns : | a list of 2^ |
void gts_graph_partition_destroy (GSList *partition);
Destroys all the graphs in partition
and frees partition
.
partition : | a list of |
typedef struct { GtsGraph * g; GtsGraph * g1; GtsGraph * g2; GHashTable * bg1; GHashTable * bg2; } GtsGraphBisection;
gboolean gts_graph_bisection_check (GtsGraphBisection *bg);
Checks that the boundary of bg
is correctly defined (used for
debugging purposes).
bg : | |
Returns : | |
GtsGraphBisection * gts_graph_ggg_bisection (GtsGraph *g,guint ntry);
An implementation of the "Greedy Graph Growing" algorithm of Karypis and Kumar (1997).
ntry
randomly chosen seeds are used and the best partition is retained.
g : | a GtsGraph. |
ntry : | the number of randomly selected initial seeds. |
Returns : | a new GtsGraphBisection of |
GtsGraphBisection * gts_graph_bfgg_bisection (GtsGraph *g,guint ntry);
An implementation of a "Breadth-First Graph Growing" algorithm.
ntry
randomly chosen seeds are used and the best partition is retained.
g : | a GtsGraph. |
ntry : | the number of randomly selected initial seeds. |
Returns : | a new GtsGraphBisection of |
gdouble gts_graph_bisection_kl_refine (GtsGraphBisection *bg,guint mmax);
An implementation of the simplified Kernighan-Lin algorithm for graph bisection refinement as described in Karypis and Kumar (1997).
The algorithm stops if mmax
consecutive modes do not lead to a
decrease in the number of edges cut. This last mmax
moves are
undone.
bg : | |
mmax : | the maximum number of unsuccessful successive moves. |
Returns : | the decrease in the weight of the edges cut by the bisection. |
gdouble gts_graph_bisection_bkl_refine (GtsGraphBisection *bg,guint mmax,gfloat imbalance);
An implementation of the simplified boundary Kernighan-Lin algorithm for graph bisection refinement as described in Karypis and Kumar (1997).
The algorithm stops if mmax
consecutive modes do not lead to a
decrease in the number of edges cut. This last mmax
moves are
undone.
bg : | |
mmax : | the maximum number of unsuccessful successive moves. |
imbalance : | the maximum relative imbalance allowed between the weights of both halves of the partition. |
Returns : | the decrease in the weight of the edges cut by the bisection. |
GtsGraphBisection * gts_graph_bisection_new (GtsWGraph *wg,guint ntry,guint mmax,guint nmin,gfloat imbalance);
An implementation of a multilevel bisection algorithm as presented
in Karypis and Kumar (1997). A multilevel hierarchy of graphs is
created using the GtsPGraph object. The bisection of the coarsest
graph is created using the gts_graph_ggg_bisection()
function. The
graph is then uncoarsened using gts_pgraph_down()
and at each level
the bisection is refined using gts_graph_bisection_bkl_refine()
.
wg : | a GtsWGraph. |
ntry : | the number of tries for the graph growing algorithm. |
mmax : | the number of unsucessful moves for the refinement algorithm. |
nmin : | the minimum number of nodes of the coarsest graph. |
imbalance : | the maximum relative imbalance allowed between the weights of both halves of the partition. |
Returns : | a new GtsGraphBisection of |
void gts_graph_bisection_destroy (GtsGraphBisection *bg,gboolean destroy_graphs);
Frees all the memory allocated for bg
. If destroy_graphs
is bg
are destroyed.
bg : | |
destroy_graphs : | controls graph destruction. |
<<< [Insert title here] | gtsconfig >>> |