LOCAL void set_oned_state_from_interface( float *coords, Locstate s, COMP_TYPE *ct, ONED_OVERLAY *olay) { HYPER_SURF *hs; HYPER_SURF_ELEMENT *hse; POINT *p; float coords_on[MAXD]; if (nearest_interface_point(coords,ct->comp,olay->intfc1d, INCLUDE_BOUNDARIES,NULL, coords_on,NULL,&hse,&hs) != YES) { screen("ERROR in set_oned_state_from_interface(), " "nearest_interface_point() failed\n"); clean_up(ERROR); } coords[0] = coords_on[0]; p = Point_of_hs(hs); if (ct->comp == positive_component(hs)) ft_assign(s,right_state(p),ct->params->sizest); else if (ct->comp == negative_component(hs)) ft_assign(s,left_state(p),ct->params->sizest); else { screen("ERROR in set_oned_state_from_interface(), " "ct->comp not on interface\n"); clean_up(ERROR); } Init_params(s,ct->params); } /*end set_oned_state_from_interface*/
EXPORT COMPONENT nearest_interior_comp( boolean multiple_comps, COMPONENT dflt_comp, double *coords, INTERFACE *intfc) { COMPONENT comp; double t[MAXD], coords_on[MAXD]; HYPER_SURF *hs; HYPER_SURF_ELEMENT *hse; if ((multiple_comps == NO) || (intfc->hss == NULL)) return dflt_comp; comp = component(coords,intfc); if (!is_exterior_comp(comp,intfc)) return comp; if (nearest_interface_point(coords,comp,intfc,INCLUDE_BOUNDARIES,NULL, coords_on,t,&hse,&hs) != YES) { screen("ERROR in nearest_interior_comp(), " "nearest_interface_point() failed\n"); clean_up(ERROR); } return (is_exterior_comp(negative_component(hs),intfc)) ? positive_component(hs) : negative_component(hs); } /*end nearest_interior_comp*/