@@ -98,11 +98,11 @@ static vector3 cartesian_to_lattice(vector3 v)
9898 v );
9999}
100100
101- /* geom_fix_object is called after an object's externally-configurable parameters
101+ /* geom_fix_object_ptr is called after an object's externally-configurable parameters
102102 have been initialized, but before any actual geometry calculations are done;
103103 it is an opportunity to (re)compute internal data fields (such as cached
104104 rotation matrices) that depend on externally-configurable parameters.
105-
105+
106106 One example: "Fix" the parameters of the given object to account for the
107107 geometry_lattice basis, which may be non-orthogonal. In particular,
108108 this means that the normalization of several unit vectors, such
@@ -111,7 +111,7 @@ static vector3 cartesian_to_lattice(vector3 v)
111111 Unfortunately, we can't do this stuff at object-creation time
112112 in Guile, because the geometry_lattice variable may not have
113113 been assigned to its final value at that point. */
114- void geom_fix_object (geometric_object * o )
114+ void geom_fix_object_ptr (geometric_object * o )
115115{
116116 switch (o -> which_subclass ) {
117117 case GEOM CYLINDER :
@@ -142,7 +142,7 @@ void geom_fix_object(geometric_object *o)
142142 break ;
143143 }
144144 case GEOM PRISM :
145- {
145+ {
146146 init_prism (o );
147147 break ;
148148 }
@@ -156,7 +156,7 @@ void geom_fix_object(geometric_object *o)
156156 if (os [i ].material .which_subclass == MAT MATERIAL_TYPE_SELF )
157157 material_type_copy (& o -> material , & os [i ].material );
158158#endif
159- geom_fix_object (os + i );
159+ geom_fix_object_ptr (os + i );
160160 }
161161 break ;
162162 }
@@ -165,14 +165,25 @@ void geom_fix_object(geometric_object *o)
165165 }
166166}
167167
168+ // deprecated API — doesn't work for prisms
169+ void geom_fix_object (geometric_object o )
170+ {
171+ geom_fix_object_ptr (& o );
172+ }
173+
168174/* fix all objects in the geometry list as described in
169175 geom_fix_object, above */
170- void geom_fix_objects0 (geometric_object_list geometry )
176+ void geom_fix_object_list (geometric_object_list geometry )
171177{
172178 int index ;
173179
174180 for (index = 0 ; index < geometry .num_items ; ++ index )
175- geom_fix_object (geometry .items + index );
181+ geom_fix_object_ptr (geometry .items + index );
182+ }
183+
184+ void geom_fix_objects0 (geometric_object_list geometry )
185+ {
186+ geom_fix_object_list (geometry );
176187}
177188
178189void geom_fix_objects (void )
@@ -239,7 +250,7 @@ void geom_initialize(void)
239250
240251boolean CTLIO point_in_objectp (vector3 p , geometric_object o )
241252{
242- geom_fix_object (& o );
253+ geom_fix_object_ptr (& o );
243254 return point_in_fixed_objectp (p , o );
244255}
245256
@@ -420,7 +431,7 @@ vector3 from_geom_object_coords(vector3 p, geometric_object o)
420431
421432vector3 CTLIO normal_to_object (vector3 p , geometric_object o )
422433{
423- geom_fix_object (& o );
434+ geom_fix_object_ptr (& o );
424435 return normal_to_fixed_object (p , o );
425436}
426437
@@ -484,7 +495,7 @@ vector3 normal_to_fixed_object(vector3 p, geometric_object o)
484495 } // case BLK ELLIPSOID
485496
486497 } // switch (o.subclass.block_data->which_subclass)
487-
498+
488499 } // case GEOM BLOCK
489500
490501 case GEOM PRISM :
@@ -557,7 +568,7 @@ vector3 normal_to_fixed_object(vector3 p, geometric_object o)
557568
558569boolean CTLIO point_in_periodic_objectp (vector3 p , geometric_object o )
559570{
560- geom_fix_object (& o );
571+ geom_fix_object_ptr (& o );
561572 return point_in_periodic_fixed_objectp (p , o );
562573}
563574
@@ -654,7 +665,7 @@ material_type material_of_point(vector3 p)
654665
655666void CTLIO display_geometric_object_info (int indentby , geometric_object o )
656667{
657- geom_fix_object (& o );
668+ geom_fix_object_ptr (& o );
658669 printf ("%*s" , indentby , "" );
659670 switch (o .which_subclass ) {
660671 case GEOM CYLINDER :
@@ -1081,7 +1092,7 @@ static number compute_dot_cross(vector3 a, vector3 b, vector3 c)
10811092 etcetera. */
10821093void geom_get_bounding_box (geometric_object o , geom_box * box )
10831094{
1084- geom_fix_object (& o );
1095+ geom_fix_object_ptr (& o );
10851096
10861097 /* initialize to empty box at the center of the object: */
10871098 box -> low = box -> high = o .center ;
@@ -2007,7 +2018,7 @@ geometric_object make_cylinder(material_type material, vector3 center,
20072018 o .subclass .cylinder_data -> height = height ;
20082019 o .subclass .cylinder_data -> axis = axis ;
20092020 o .subclass .cylinder_data -> which_subclass = CYL CYLINDER_SELF ;
2010- geom_fix_object (& o );
2021+ geom_fix_object_ptr (& o );
20112022 return o ;
20122023}
20132024
@@ -2033,7 +2044,7 @@ geometric_object make_wedge(material_type material, vector3 center,
20332044 CHECK (o .subclass .cylinder_data -> subclass .wedge_data , "out of memory" );
20342045 o .subclass .cylinder_data -> subclass .wedge_data -> wedge_angle = wedge_angle ;
20352046 o .subclass .cylinder_data -> subclass .wedge_data -> wedge_start = wedge_start ;
2036- geom_fix_object (& o );
2047+ geom_fix_object_ptr (& o );
20372048 return o ;
20382049}
20392050
@@ -2061,7 +2072,7 @@ geometric_object make_block(material_type material, vector3 center,
20612072 o .subclass .block_data -> e3 = e3 ;
20622073 o .subclass .block_data -> size = size ;
20632074 o .subclass .block_data -> which_subclass = BLK BLOCK_SELF ;
2064- geom_fix_object (& o );
2075+ geom_fix_object_ptr (& o );
20652076 return o ;
20662077}
20672078
@@ -2090,7 +2101,7 @@ geometric_object make_ellipsoid(material_type material, vector3 center,
20902101 * Most calculations are done in the "prism coordinate system",
20912102 * in which the prism floor lies in the XY plane with centroid
20922103 * at the origin and the prism axis is the positive Z-axis.
2093- * Some variable naming conventions:
2104+ * Some variable naming conventions:
20942105 * -- Suffix 'p' or '_p' on variable names identifies variables
20952106 * storing coordinates or vector components in the prism system.
20962107 * Suffix 'c' or '_c' (or no suffix) corresponds to coodinates/components
@@ -2209,7 +2220,7 @@ boolean node_in_or_on_polygon(vector3 q0, vector3 *nodes, int num_nodes,
22092220 { int status = intersect_ray_with_segment (q0 , nodes [nn ], nodes [(nn + 1 )%num_nodes ], u , 0 );
22102221 if (status == IN_SEGMENT )
22112222 return include_boundaries ;
2212- else if (status == INTERSECTING )
2223+ else if (status == INTERSECTING )
22132224 edges_crossed ++ ;
22142225 else if (status == ON_RAY )
22152226 { vector3 nm1 = nodes [ (nn == 0 ? num_nodes - 1 : nn - 1 ) ];
@@ -2263,7 +2274,7 @@ boolean point_in_prism(prism *prsm, vector3 pc)
22632274
22642275// comparator for qsort
22652276static int dcmp (const void * pd1 , const void * pd2 )
2266- { double d1 = * ((double * )pd1 ), d2 = * ((double * )pd2 );
2277+ { double d1 = * ((double * )pd1 ), d2 = * ((double * )pd2 );
22672278 return (d1 < d2 ) ? -1.0 : (d1 > d2 ) ? 1.0 : 0.0 ;
22682279}
22692280
@@ -2418,7 +2429,7 @@ double normal_distance_to_plane(vector3 p,
24182429// the in-plane distance from pPlane to the quadrilateral
24192430double min_distance_to_quadrilateral (vector3 p ,
24202431 vector3 o , vector3 v1 , vector3 v2 , vector3 v3 )
2421- {
2432+ {
24222433 int inside ;
24232434 double s = normal_distance_to_plane (p , o , v1 , v2 , v3 , & inside );
24242435 if (inside == 1 )
@@ -2511,7 +2522,7 @@ void get_prism_bounding_box(prism *prsm, geom_box *box)
25112522 int nv , fc ;
25122523 for (nv = 0 ; nv < num_vertices ; nv ++ )
25132524 for (fc = 0 ; fc < 2 ; fc ++ ) // 'floor,ceiling'
2514- {
2525+ {
25152526 vector3 v = vertices [nv ];
25162527 if (fc == 1 )
25172528 v = vector3_plus (v , vector3_scale (prsm -> height , prsm -> axis ) );
0 commit comments