--- C:/Users/Myš/AppData/Local/Temp/surfaceintersect.cpp-rev66794.svn001.tmp.cpp čt 10 29 05:02:06 2015 +++ C:/BRL-CAD/brlcad-svn/src/proc-db/surfaceintersect.cpp po 12 26 20:11:35 2016 @@ -4 +4 @@ - * Copyright (c) 2009-2014 United States Government as represented by + * Copyright (c) 2009-2016 United States Government as represented by @@ -36,19 +35,0 @@ - * ClosestValue - * - * @brief returns the value that is closest to the given value but in - * the given interval - */ -double -ClosestValue(double value, ON_Interval interval) -{ - if (interval.Includes(value, true)) { - return value; - } else if (value < interval.Min()) { - return interval.Min(); - } else { - return interval.Max(); - } -} - - -/** @@ -221,27 +201,0 @@ Curve_Compare_start(ON_Curve *const *a, ON_Curve * - * Curve_Compare_end - * - * @brief Compares the end points of the curve profiles - */ -int -Curve_Compare_end(const ON_Curve **a, const ON_Curve **b) -{ - ON_3dVector A = ON_2dVector((*a)->PointAtEnd().x, (*a)->PointAtEnd().y); - ON_3dVector B = ON_2dVector((*b)->PointAtEnd().x, (*b)->PointAtEnd().y); - if (V2NEAR_EQUAL(A, B, 1e-9)) { - return 0; - } else if (A.x < B.x) { - return -1; - } else if (A.x > B.x) { - return 1; - } else if (A.y < B.y) { - return -1; - } else if (A.y > B.y) { - return 1; - } - - /* we should have already done this... but just in case */ - return 0; -} - - -/** @@ -1046,95 +999,0 @@ MakeTwistedCubeFaces2(ON_Brep& brep) - -ON_Brep* -MakeTwistedSquare1(ON_TextLog& error_log) -{ - ON_3dPoint point[8] = { - ON_3dPoint(1.0, 1.0, 1.0), // Point A - ON_3dPoint(-1.0, -1.0, 1.0), // Point B - ON_3dPoint(-1.0, -1.0, -1.0), // Point C - ON_3dPoint(1.0, 1.0, -1.0), // Point D - }; - - ON_Brep* brep = new ON_Brep(); - - // create eight vertices located at the eight points - for (int i = 0; i < 4; i++) { - ON_BrepVertex& v = brep->NewVertex(point[i]); - v.m_tolerance = 0.0; - // this example uses exact tolerance... reference - // ON_BrepVertex for definition of non-exact data - } - - // create 3d curve geometry - the orientations are arbitrarily - // chosen so that the end vertices are in alphabetical order - brep->m_C3.Append(TwistedCubeEdgeCurve(point[A], point[B])); // AB - brep->m_C3.Append(TwistedCubeEdgeCurve(point[B], point[C])); // BC - brep->m_C3.Append(TwistedCubeEdgeCurve(point[C], point[D])); // CD - brep->m_C3.Append(TwistedCubeEdgeCurve(point[A], point[D])); // AD - - // create the 12 edges the connect the corners - MakeTwistedCubeEdges1(*brep); - - // create the 3d surface geometry. the orientations are arbitrary so - // some normals point into the cube and other point out... not sure why - brep->m_S.Append(TwistedCubeSideSurface(point[A], point[B], point[C], point[D])); - - // create the faces - MakeTwistedCubeFaces1(*brep); - - if (brep && !brep->IsValid()) { - error_log.Print("Twisted cube b-rep is not valid!\n"); - delete brep; - brep = NULL; - } - - return brep; -} - - -ON_Brep* -MakeTwistedSquare2(ON_TextLog& error_log) -{ - ON_3dPoint point[8] = { - ON_3dPoint(1.0, -1.0, 1.0), // Point E - ON_3dPoint(-1.0, 1.0, 1.0), // Point F - ON_3dPoint(-1.0, -1.0, 1.0), // Point G - ON_3dPoint(1.0, -1.0, -1.0), // Point H - }; - - ON_Brep* brep = new ON_Brep(); - - // create eight vertices located at the eight points - for (int i = 0; i < 4; i++) { - ON_BrepVertex& v = brep->NewVertex(point[i]); - v.m_tolerance = 0.0; - // this example uses exact tolerance... reference - // ON_BrepVertex for definition of non-exact data - } - - // create 3d curve geometry - the orientations are arbitrarily - // chosen so that the end vertices are in alphabetical order - brep->m_C3.Append(TwistedCubeEdgeCurve(point[E], point[F])); // EF - brep->m_C3.Append(TwistedCubeEdgeCurve(point[F], point[G])); // FG - brep->m_C3.Append(TwistedCubeEdgeCurve(point[G], point[si::H])); // GH - brep->m_C3.Append(TwistedCubeEdgeCurve(point[E], point[si::H])); // EH - - // create the 12 edges the connect the corners - MakeTwistedCubeEdges2(*brep); - - // create the 3d surface geometry. the orientations are arbitrary so - // some normals point into the cube and other point out... not sure why - brep->m_S.Append(TwistedCubeSideSurface(point[E], point[F], point[G], point[si::H])); - - // create the faces - MakeTwistedCubeFaces2(*brep); - - if (brep && !brep->IsValid()) { - error_log.Print("Twisted cube b-rep is not valid!\n"); - delete brep; - brep = NULL; - } - - return brep; -} - -