-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2021 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
*/
void QuadraticPlanarInterpTest::checkHighLevelFunctionTest1()
{
- QUADRATIC_PLANAR::setPrecision(1e-12);
- QUADRATIC_PLANAR::setArcDetectionPrecision(1e-9);
+ QuadraticPlanarPrecision::setPrecision(1e-10);
double coords[]={
8.8334591186000004, 5.0999999999999996,
7.1014083111000001, 6.0999999999999996,
ElementaryEdge *e1=dynamic_cast<ElementaryEdge *>((*pol)[1]);
ElementaryEdge *e2=dynamic_cast<ElementaryEdge *>((*pol)[0]);
CPPUNIT_ASSERT(e0); CPPUNIT_ASSERT(e1); CPPUNIT_ASSERT(e2);
- CPPUNIT_ASSERT(dynamic_cast<EdgeLin *>(e0->getPtr()));//<- testing detection of colinearity
+ CPPUNIT_ASSERT(dynamic_cast<EdgeLin *>(e0->getPtr()));// <- testing detection of colinearity
CPPUNIT_ASSERT(dynamic_cast<EdgeArcCircle *>(e1->getPtr()));
- CPPUNIT_ASSERT(dynamic_cast<EdgeLin *>(e2->getPtr()));//<- testing detection of colinearity
+ CPPUNIT_ASSERT(dynamic_cast<EdgeLin *>(e2->getPtr()));// <- testing detection of colinearity
nodes.clear();
delete pol;
nodes.push_back(new Node(coords));
e1=dynamic_cast<ElementaryEdge *>((*pol)[1]);
e2=dynamic_cast<ElementaryEdge *>((*pol)[0]);
CPPUNIT_ASSERT(e0); CPPUNIT_ASSERT(e1); CPPUNIT_ASSERT(e2);
- CPPUNIT_ASSERT(dynamic_cast<EdgeLin *>(e0->getPtr()));//<- testing detection of colinearity
+ CPPUNIT_ASSERT(dynamic_cast<EdgeLin *>(e0->getPtr()));// <- testing detection of colinearity
CPPUNIT_ASSERT(dynamic_cast<EdgeArcCircle *>(e1->getPtr()));
- CPPUNIT_ASSERT(dynamic_cast<EdgeLin *>(e2->getPtr()));//<- testing detection of colinearity
+ CPPUNIT_ASSERT(dynamic_cast<EdgeLin *>(e2->getPtr()));// <- testing detection of colinearity
delete pol;
const double coords2[]={
0.,0.,
pol=QuadraticPolygon::BuildArcCirclePolygon(nodes);
pol->getBarycenter(tmp,tmp2);
delete pol;
- QUADRATIC_PLANAR::setPrecision(1e-14);
+ QuadraticPlanarPrecision::setPrecision(1e-14);
}
void QuadraticPlanarInterpTest::check1DInterpLin()
{
- QUADRATIC_PLANAR::setPrecision(1e-7);
- QUADRATIC_PLANAR::setArcDetectionPrecision(1e-9);
+ QuadraticPlanarPrecision::setPrecision(1e-9);
const int NB_OF_CELL_AXIAL_1=30;
static const double Z_VALS_1[NB_OF_CELL_AXIAL_1+1]=
{ -0.1550 , -0.1356, -0.1162, -0.0969, -0.0775 ,-0.0581, -0.0387, -0.0194, 0.0000 , 0.0500,
CPPUNIT_ASSERT_EQUAL(1,(int)m[i+2].size());
CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,m[i+2][i+9],1e-12);
}
- QUADRATIC_PLANAR::setPrecision(1e-14);
+ QuadraticPlanarPrecision::setPrecision(1e-14);
}
/*!
*/
void QuadraticPlanarInterpTest::checkEpsilonCoherency1()
{
- INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-12);
- INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-5);
+ INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-12);
const double pol1[]={
-2.1083388455000001, 1.2172499999999999,
void QuadraticPlanarInterpTest::checkNonRegression2()
{
- QUADRATIC_PLANAR::setPrecision(1e-12);
- QUADRATIC_PLANAR::setArcDetectionPrecision(1e-9);
+ QuadraticPlanarPrecision::setPrecision(1e-12);
double coords1[]=
{
15.141499999899999, -26.226033271399999,
void QuadraticPlanarInterpTest::checkNonRegression4()
{
- QUADRATIC_PLANAR::setPrecision(1e-12);
- QUADRATIC_PLANAR::setArcDetectionPrecision(1e-9);
+ QuadraticPlanarPrecision::setPrecision(1e-12);
double coords1[]=
{
10.962340811000001, -22.417749999000002,
void QuadraticPlanarInterpTest::checkNonRegression5()
{
- INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-12);
- INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-5);
+ INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-12);
double coords1[]=
{
-1.7320508075000001, 1,
void QuadraticPlanarInterpTest::checkNonRegression6()
{
- QUADRATIC_PLANAR::setPrecision(1e-12);
- QUADRATIC_PLANAR::setArcDetectionPrecision(1e-5);
+ QuadraticPlanarPrecision::setPrecision(1e-12);
double coords1[]=
{
10.962340811000001, -22.417749999000002,
void QuadraticPlanarInterpTest::checkNonRegression7()
{
- QUADRATIC_PLANAR::setPrecision(1e-5);
- QUADRATIC_PLANAR::setArcDetectionPrecision(1e-5);
+ QuadraticPlanarPrecision::setPrecision(1e-5);
double coords1[]=
{
-2., 0,
void QuadraticPlanarInterpTest::checkNonRegression8()
{
- QUADRATIC_PLANAR::setPrecision(1e-3);
- QUADRATIC_PLANAR::setArcDetectionPrecision(1e-5);
+ QuadraticPlanarPrecision::setPrecision(1e-3);
double coords1[]=
{
-13.933240959000001, -28.559499999,
void QuadraticPlanarInterpTest::checkNonRegression9()
{
- QUADRATIC_PLANAR::setPrecision(1e-7);
- QUADRATIC_PLANAR::setArcDetectionPrecision(1e-8);
+ QuadraticPlanarPrecision::setPrecision(1e-8);
double coords1[]=
{
-0.04476229252902969, -0.085118027765365603,
void QuadraticPlanarInterpTest::checkNonRegression10()
{
- INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
- INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
double coords1[]=
{ -0.002269581957210453, -0.09851030343724453,
-0.004268022334182935, -0.1059685844580936,
void QuadraticPlanarInterpTest::checkNonRegression11()
{
- INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
- INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
double coords1[]=
{ -0.002269581957210453, -0.09851030343724453,
-0.004268022334182935, -0.1059685844580936,
void QuadraticPlanarInterpTest::checkNonRegression12()
{
- INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-6);
- INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
double coords1[]=
{ -0.5032251558760915, -0.8716087994449138,
-0.4695268343089433, -0.8806382374805872,
void QuadraticPlanarInterpTest::checkNonRegression13()
{
- INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
- INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-6);
+ INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
double coords_1[194]={
0, 0, 0.304375, -7.454791178893722e-17, 0.2152256265236553, -0.2152256265236555, -5.591093384170291e-17, -0.304375,
*/
void QuadraticPlanarInterpTest::checkNonRegression14()
{
- INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
- INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-6);
+ INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
double coords[72]={
1.,0.,1.3,0.,-1.3,0.,-1.,0.,1.15,0.,0.,1.3,-1.15,0.,0.,1.,
*/
void QuadraticPlanarInterpTest::checkNonRegression15()
{
- INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
- INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-6);
+ INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
double coords[72]={
1.,0.,1.3,0.,-1.3,0.,-1.,0.,1.15,0.,0.,1.3,-1.15,0.,0.,1.,
*/
void QuadraticPlanarInterpTest::checkNonRegression16()
{
- INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
- INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
double coords1[194]={
0, 0, 0.304375, 0, 0.2152256265236554, 0.2152256265236554, 1.86369779472343e-17, 0.304375,
-0.2152256265236554, 0.2152256265236554, -0.304375, 3.727395589446861e-17, -0.2152256265236555, -0.2152256265236554, -5.591093384170291e-17, -0.304375,
*/
void QuadraticPlanarInterpTest::checkNonRegression17()
{
- INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
- INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
+ INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
double coords[16]={
-1., 0., 1., 0. , 1.5, 0., -1.5, 0.,
0. , 1., 1.25, 0., 0., 1.5, -1.25, 0.};
void QuadraticPlanarInterpTest::checkNormalize()
{
- INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-14);
+ INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-14);
Node *n1=new Node(0.,0.); Node *n4=new Node(0.,-3.);
Node *n2=new Node(10.,0.); Node *n5=new Node(10.,-3.);
Node *n3=new Node(5.,10.); Node *n6=new Node(5.,7.);
void QuadraticPlanarInterpTest::checkMakePartitionAbs1()
{
- INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-14);
+ INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-14);
Node *n0=new Node(0.,0.); Node *n4=new Node(0.5,0.25);
Node *n1=new Node(0.,0.5); Node *n5=new Node(0.3,1.2);
Node *n2=new Node(1.,0.5); Node *n6=new Node(1.1,1.3);
pol1.dumpInXfigFileWithOther(pol2,"tony.fig");
}
+/**
+ * Arc/arc intersection was buggy: a point was detected OFF when used in a linear segment, but
+ * detected ON when used in an (almost flat) arc of circle.
+ */
+void QuadraticPlanarInterpTest::checkArcArcIntersection1()
+{
+ double eps=1.0e-8;
+ INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(eps);
+
+ Node *n0=new Node(6.37533,38.8928); Node *n3=new Node(6.29194,39.2789);
+ Node *n1=new Node(6.13158,38.8308); Node *n4=new Node(6.31919,38.7607);
+ Node *n2=new Node(6.25346,38.8618); Node *n5=new Node(6.38778,39.0241);
+
+ Node *n6=new Node(6.2534549999999998, 38.861800000000002); // to have a linear edge e1
+
+ //EdgeArcCircle *e1=new EdgeArcCircle(n0, n2, n6, true); // to have a linear edge e1
+ EdgeArcCircle *e1=new EdgeArcCircle(n0, n2, n1, true);
+ EdgeArcCircle *e2=new EdgeArcCircle(n3, n5, n4, true);
+
+ MergePoints merge;
+ QuadraticPolygon c1,c2;
+ e1->intersectWith(e2,merge,c1,c2);
+ CPPUNIT_ASSERT_EQUAL(2,c1.size());
+ CPPUNIT_ASSERT_EQUAL(2,c2.size());
+ //clean-up
+ n0->decrRef(); n1->decrRef(); n2->decrRef(); n3->decrRef(); n4->decrRef(); n5->decrRef(); n6->decrRef();
+ e1->decrRef(); e2->decrRef();
}
+
+
+}
+
+