Author: janehu Date: 2008-01-18 15:46:33 -0600 (Fri, 18 Jan 2008) New Revision: 1545 Modified: cgm/trunk/CMakeLists.txt cgm/trunk/Makefile.am cgm/trunk/geom/OCC/OCCCurve.cpp cgm/trunk/geom/OCC/OCCQueryEngine.cpp cgm/trunk/geom/OCC/OCCSurface.cpp cgm/trunk/geom/RefFace.cpp cgm/trunk/test/Makefile.am cgm/trunk/test/makept.cpp Log: Updated using RefFace and RefEdge for reference of testing, fixed some bug, updated some comments. Added test directory in the Makefile for future reference. Modified: cgm/trunk/CMakeLists.txt =================================================================== --- cgm/trunk/CMakeLists.txt 2008-01-18 20:09:56 UTC (rev 1544) +++ cgm/trunk/CMakeLists.txt 2008-01-18 21:46:33 UTC (rev 1545) @@ -1,5 +1,5 @@ -# do util and geom subdirs -SUBDIRS( util geom init ) +# do util and geom and test subdirs +SUBDIRS( util geom test init ) Modified: cgm/trunk/Makefile.am =================================================================== --- cgm/trunk/Makefile.am 2008-01-18 20:09:56 UTC (rev 1544) +++ cgm/trunk/Makefile.am 2008-01-18 21:46:33 UTC (rev 1545) @@ -1,5 +1,5 @@ AUTOMAKE_OPTIONS = foreign -SUBDIRS = util geom init itaps +SUBDIRS = util geom init itaps test if build_ACIS ACIS_EXAMPLE_TEST=cd cgm_apps/examples/driverc++; make check-TESTS Modified: cgm/trunk/geom/OCC/OCCCurve.cpp =================================================================== --- cgm/trunk/geom/OCC/OCCCurve.cpp 2008-01-18 20:09:56 UTC (rev 1544) +++ cgm/trunk/geom/OCC/OCCCurve.cpp 2008-01-18 21:46:33 UTC (rev 1545) @@ -436,10 +436,9 @@ *tangent_ptr = CubitVector(tangent.X(), tangent.Y(), tangent.Z()); } } - if (curvature_ptr != NULL) { - double curvature = CLP.Curvature(); - // Danilov: confused here - } + if (curvature_ptr != NULL) + get_curvature( location, *curvature_ptr); + if (param != NULL) { *param = newVal; } Modified: cgm/trunk/geom/OCC/OCCQueryEngine.cpp =================================================================== --- cgm/trunk/geom/OCC/OCCQueryEngine.cpp 2008-01-18 20:09:56 UTC (rev 1544) +++ cgm/trunk/geom/OCC/OCCQueryEngine.cpp 2008-01-18 21:46:33 UTC (rev 1545) @@ -782,7 +782,7 @@ //=========================================================================== //Function Name:export_solid_model //Member Type: PUBLIC -//Description: function called for save/restore to save temporary FACET file +//Description: function called for save/restore to save temporary Brep file //Author: Jane Hu //Date: 11/16/2007 //=========================================================================== @@ -909,6 +909,14 @@ return CUBIT_SUCCESS; } +//=========================================================================== +//Function Name:export_solid_model +//Member Type: PUBLIC +//Description: function called for write out temporary Brep file +//Author: Jane Hu +//Date: 11/16/2007 +//=========================================================================== + CubitStatus OCCQueryEngine::write_topology( const char* file_name, DLIList<OCCBody*> &OCC_bodies, @@ -1002,6 +1010,14 @@ return CUBIT_FAILURE; } +//=========================================================================== +//Function Name:import_solid_model +//Member Type: PUBLIC +//Description: function called for read in temporary Brep file +//Author: Jane Hu +//Date: 11/16/2007 +//=========================================================================== + CubitStatus OCCQueryEngine::import_solid_model( const char* file_name , const char* file_type, @@ -1025,6 +1041,14 @@ return CUBIT_SUCCESS; } +//=========================================================================== +//Function Name:populate_topology_bridge +//Member Type: PUBLIC +//Description: function called for populating topology bridge for OCC entity +//Author: Jane Hu +//Date: 11/16/2007 +//=========================================================================== + DLIList<TopologyBridge*> OCCQueryEngine::populate_topology_bridge(TopoDS_Shape aShape) { DLIList<TopologyBridge*> tblist; @@ -1707,6 +1731,16 @@ } } + +//------------------------------------------------------------------------- +// Purpose : fire a ray at the specified body, returning the entities hit. +// +// Special Notes : +// +// Creator : Jane Hu +// +// Creation Date : 12/12/07 +//------------------------------------------------------------------------- CubitStatus OCCQueryEngine::fire_ray(BodySM * body, const CubitVector &start, const CubitVector &unit, @@ -2065,7 +2099,7 @@ // Function : bodies_overlap // Member Type: PUBLIC // Description: determine if OCC-based bodies overlap -// Author : +// Author : Jane Hu // Date : 10/07 //=============================================================================== CubitBoolean OCCQueryEngine::bodies_overlap (BodySM * body_ptr_1, Modified: cgm/trunk/geom/OCC/OCCSurface.cpp =================================================================== --- cgm/trunk/geom/OCC/OCCSurface.cpp 2008-01-18 20:09:56 UTC (rev 1544) +++ cgm/trunk/geom/OCC/OCCSurface.cpp 2008-01-18 21:46:33 UTC (rev 1545) @@ -310,7 +310,7 @@ int i; Extrema_ExtPS ext(p, asurface, Precision::Approximation(), Precision::Approximation()); if (ext.IsDone() && (ext.NbExt() > 0)) { - for ( i = 1 ; i < ext.NbExt() ; i++ ) { + for ( i = 1 ; i <= ext.NbExt() ; i++ ) { if ( (i==1) || (p.Distance(ext.Point(i).Value()) < minDist) ) { minDist = p.Distance(ext.Point(i).Value()); newP = ext.Point(i).Value(); Modified: cgm/trunk/geom/RefFace.cpp =================================================================== --- cgm/trunk/geom/RefFace.cpp 2008-01-18 20:09:56 UTC (rev 1544) +++ cgm/trunk/geom/RefFace.cpp 2008-01-18 21:46:33 UTC (rev 1545) @@ -1486,8 +1486,8 @@ CubitStatus RefFace::get_point_normal( CubitVector& origin, CubitVector& normal ) { - if( is_planar() == CUBIT_FALSE) - return CUBIT_FAILURE; + //if( is_planar() == CUBIT_FALSE) + // return CUBIT_FAILURE; Surface* surface_ptr = get_surface_ptr(); Modified: cgm/trunk/test/Makefile.am =================================================================== --- cgm/trunk/test/Makefile.am 2008-01-18 20:09:56 UTC (rev 1544) +++ cgm/trunk/test/Makefile.am 2008-01-18 21:46:33 UTC (rev 1545) @@ -13,13 +13,8 @@ -I..\$(OCC_INC_FLAG) TESTS = makept -if build_ACIS - TESTS += webcut -endif - check_PROGRAMS = $(TESTS) -webcut_SOURCES = webcut.cpp makept_SOURCES = makept.cpp opt_libs= LDADD = ../geom/virtual/libcubit_virtual.la \ @@ -30,9 +25,6 @@ ../geom/libcubit_geom.la \ ../util/libcubit_util.la -if build_ACIS - opt_libs += ../geom/ACIS/libcubit_ACIS.la -endif if WITH_OCC opt_libs += ../geom/OCC/libcubit_OCC.la $(OCC_LIB_FLAG) $(OCC_LIBS) endif Modified: cgm/trunk/test/makept.cpp =================================================================== --- cgm/trunk/test/makept.cpp 2008-01-18 20:09:56 UTC (rev 1544) +++ cgm/trunk/test/makept.cpp 2008-01-18 21:46:33 UTC (rev 1545) @@ -4,10 +4,7 @@ * \brief makept, another simple C++ driver for CGM * * This program acts as a simple driver for CGM. It reads in a geometry, - * performs imprints between all the bodies, merges them, and writes information - * on the results. It also performs pairwise intersections between the - * bodies to check for overlaps. Results are written to stardard output. - * + * and performs varies checks for bodies, surfaces, curves and vertices. */ #include "config.h" #include "CpuTimer.hpp" @@ -124,18 +121,20 @@ CubitVector vector1(10,10,10); CubitVector vector2(15,15,15); DLIList<RefEntity*> free_entities; + + // Make two vertices. + gmti->make_RefVertex(vector1,5); + gmti->make_RefVertex(vector2,5); + gti->get_free_ref_entities(free_entities); - + + //translate the two vertice by (10,10,10) and (20,20,20) for(int i = 1; i <= free_entities.size(); i++) { RefEntity * entity = free_entities.get_and_step(); - gti->translate((BasicTopologyEntity*)entity, i*vector1); + gti->translate((BasicTopologyEntity*)entity, i*vector1); } - // Read in the geometry from files specified on the command line - gmti->make_RefVertex(vector1,5); - gmti->make_RefVertex(vector2,5); - CubitStatus rsl = CUBIT_SUCCESS; DLIList<RefEntity*> ref_entity_list; int num_ents_exported=0; @@ -150,6 +149,8 @@ //check for vertex DLIList<Body*> bodies; gti->bodies(bodies); + free_entities.clean_out(); //currently there's bug in that it created + //new entities after translating, debug next week. gti->get_free_ref_entities(free_entities); RefVertex* vertex1 = CAST_TO(free_entities.get_and_step(),RefVertex); @@ -161,7 +162,9 @@ CubitVector vi, vii; double d; gti->entity_entity_distance(vertex1,vertex2,vi, vii,d); - // distance (d) between vertex1,vertex2 + // distance (d) between vertex1,vertex2. vi (20, 20, 20) is vertex1 + //translated by (10,10,10) and vii(35, 35, 35) is vertex2 translated + //by 2*(10,10,10). //check for body d = bodies.get()->measure(); @@ -174,9 +177,11 @@ //first body's bounding box. gti->entity_entity_distance(gti->get_first_ref_volume(), vertex2,vi, vii,d); - //first body and vertex2 's distance(d). + //first body and vertex2 's minimum distance(d) and locations for the minimum. BodySM* body = bodies.get()->get_body_sm_ptr(); + OCCBody* occ_body = CAST_TO(body, OCCBody); + CubitVector axis(10,0,0); gti->reflect(bodies, axis); vi = bodies.get()->center_point(); @@ -194,7 +199,6 @@ vi = bodies.get()->center_point(); // After rotation, center point changed in y and z value. - OCCBody* occ_body = CAST_TO(body, OCCBody); occ_body->mass_properties(vi, d); //true center and volume, volume should be 8 times of the original one. @@ -203,7 +207,6 @@ //check for surface DLIList<OCCSurface*> surfaces; - CAST_TO(body, OCCBody)->get_all_surfaces(surfaces); OCCSurface* surface = surfaces.step_and_get(); GeometryType type = surface->geometry_type(); @@ -212,11 +215,15 @@ box = surface->bounding_box(); // bounding box - vi = surface->center_point(); + DLIList<RefFace*> ref_faces; + gti->ref_faces(ref_faces); + RefFace* ref_face = ref_faces.step_and_get(); + + vi = ref_face->center_point(); // center point CubitVector normal; - surface->get_point_normal(vi, normal); + ref_face->get_point_normal(vi, normal); // surface normal at center point. CubitVector closest_location ; @@ -224,35 +231,41 @@ CubitVector curvature1_ptr ; CubitVector curvature2_ptr ; - surface->closest_point(vi, &closest_location, &unit_normal_ptr, - &curvature1_ptr, &curvature2_ptr); - // another way to get normal at center point, and found surface - // projection location for vi. + ref_face->find_closest_point_trimmed(vi, closest_location); + // Found surface projection location for vi. double curvature1, curvature2; - surface->principal_curvatures(closest_location, curvature1, curvature2); + ref_face->get_principal_curvatures(closest_location, curvature1, curvature2); // get principal curvatures at center point. - double u = 0.5; + double area = ref_face->area(); + // area of the face + + double u = 2.5; double v = -20000; - vi = surface->position_from_u_v(u,v); + vi = ref_face->position_from_u_v(u,v); // get location on surface for it's u,v - CubitBoolean periodic = surface->is_periodic(); + ref_face->u_v_from_position(vi, u, v); + // get (u,v) from this vi. + + CubitBoolean periodic = ref_face->is_periodic(); // found if surface is periodic. double p = 0; //period - periodic = surface->is_periodic_in_U(p); + periodic = ref_face->is_periodic_in_U(p); // found if surface is periodic in U and its period. - periodic = surface->is_periodic_in_V(p); + periodic = ref_face->is_periodic_in_V(p); // found if surface is periodic in V and its period. + //All OCC entities are parametric. + double lower, upper; - surface->get_param_range_U(lower, upper); + ref_face->get_param_range_U(lower, upper); // get surface U direction boundaries. here it's (2.48, 3.91) - surface->get_param_range_V(lower, upper); + ref_face->get_param_range_V(lower, upper); // get surface V direction boundaries. here it's (-20010,-19998) CubitBoolean closed = surface->is_closed_in_U(); @@ -261,13 +274,17 @@ closed = surface->is_closed_in_V(); // check if surface is closed in V direction. - CubitPointContainment pc = surface->point_containment(1,-20000); + CubitPointContainment pc = ref_face->point_containment(1,-20000); // this (u,v) location should be outside of the surface. - CubitPointContainment pc2 = surface->point_containment(3,-20000); + CubitPointContainment pc2 = ref_face->point_containment(3,-20000); // this (u,v) location should be inside of the surface. //test for curve + DLIList<RefEdge *> ref_edges; + gti->ref_edges(ref_edges); + RefEdge* ref_edge = ref_edges.step_and_get(); + DLIList<OCCCurve*> curves; CAST_TO(body, OCCBody)->get_all_curves(curves); @@ -278,42 +295,42 @@ box = curve-> bounding_box(); // bounding box - d = curve->measure(); + d = ref_edge->measure(); // length of the curve. - curve->get_param_range(lower,upper); + ref_edge->get_param_range(lower,upper); // paremeter range. - d = curve->length_from_u(lower,upper); + d = ref_edge->length_from_u(lower,upper); // double check whole curve length. - d = curve->length_from_u(lower/2+upper/2, upper); + d = ref_edge->length_from_u(lower/2+upper/2, upper); // half curve length. - periodic = curve->is_periodic(p); + periodic = ref_edge->is_periodic(p); // if curve is periodic and its period (p). here it's not. - curve->position_from_u(lower/2+upper/2, vi); + ref_edge->position_from_u(lower/2+upper/2, vi); // middle point. + u = ref_edge->u_from_position(vi); + // middle point's u value. + CubitVector c_point, tangent, center; double radius; - curve->closest_point(vi, c_point); + ref_edge->closest_point(vi, c_point, &tangent, & curvature1_ptr); // Closed point on middle point. - curve->get_tangent(vi, tangent); + ref_edge->tangent(vi, tangent); // tangent at middle point. - curve->get_point_direction(c_point, tangent); + ref_edge->get_point_direction(c_point, tangent); // double check tangent - curve->get_curvature(c_point, curvature1_ptr); - // get mid-point curvature. - - curve->get_center_radius(center, radius); + ref_edge->get_center_radius(center, radius); // center and radius for arc curves - pc = curve->point_containment(c_point); + pc = ref_edge->point_containment(c_point); // middle point should be on the curve. //delete all entities
participants (1)
-
janehu@mcs.anl.gov