764 |
self.failUnless(c.getStartPoint()==p0, "wrong start point of spline curve") |
self.failUnless(c.getStartPoint()==p0, "wrong start point of spline curve") |
765 |
self.failUnless(c.getEndPoint()==p3, "wrong end point of spline curve") |
self.failUnless(c.getEndPoint()==p3, "wrong end point of spline curve") |
766 |
|
|
767 |
|
self.failUnless(c.hasSameOrientation(c),"has not same orientation like itself") |
768 |
|
self.failUnless(not c.hasSameOrientation(-c),"has same orientation like -itself") |
769 |
|
|
770 |
self.failUnless(not c.isColocated(p1),"spline is colocated with point.") |
self.failUnless(not c.isColocated(p1),"spline is colocated with point.") |
771 |
self.failUnless(not c.isColocated(Spline(p0,p1,p2)),"spline is colocated with spline of different length.") |
self.failUnless(not c.isColocated(Spline(p0,p1,p2)),"spline is colocated with spline of different length.") |
772 |
self.failUnless(not c.isColocated(Spline(p0,p1,p4,p3)),"spline is colocated with spline with different point.") |
self.failUnless(not c.isColocated(Spline(p0,p1,p4,p3)),"spline is colocated with spline with different point.") |
841 |
self.failUnless(c.getStartPoint()==p3, "wrong start point of reverse spline curve") |
self.failUnless(c.getStartPoint()==p3, "wrong start point of reverse spline curve") |
842 |
self.failUnless(c.getEndPoint()==p0, "wrong end point of reverse spline curve") |
self.failUnless(c.getEndPoint()==p0, "wrong end point of reverse spline curve") |
843 |
|
|
844 |
|
self.failUnless(c.hasSameOrientation(c),"has not same orientation like itself") |
845 |
|
self.failUnless(not c.hasSameOrientation(-c),"has same orientation like -itself") |
846 |
|
|
847 |
self.failUnless(not c.isColocated(p1),"reverse spline is colocated with point.") |
self.failUnless(not c.isColocated(p1),"reverse spline is colocated with point.") |
848 |
self.failUnless(not c.isColocated(Spline(p0,p1,p2)),"reverse spline is colocated with spline of different length.") |
self.failUnless(not c.isColocated(Spline(p0,p1,p2)),"reverse spline is colocated with spline of different length.") |
849 |
self.failUnless(not c.isColocated(Spline(p0,p1,p4,p3)),"reverse spline is colocated with spline with different point.") |
self.failUnless(not c.isColocated(Spline(p0,p1,p4,p3)),"reverse spline is colocated with spline with different point.") |
985 |
self.failUnless(c.getStartPoint()==p0, "wrong start point of spline curve") |
self.failUnless(c.getStartPoint()==p0, "wrong start point of spline curve") |
986 |
self.failUnless(c.getEndPoint()==p3, "wrong end point of spline curve") |
self.failUnless(c.getEndPoint()==p3, "wrong end point of spline curve") |
987 |
|
|
988 |
|
self.failUnless(c.hasSameOrientation(c),"has not same orientation like itself") |
989 |
|
self.failUnless(not c.hasSameOrientation(-c),"has same orientation like -itself") |
990 |
|
|
991 |
self.failUnless(not c.isColocated(p1),"spline is colocated with point.") |
self.failUnless(not c.isColocated(p1),"spline is colocated with point.") |
992 |
self.failUnless(not c.isColocated(BSpline(p0,p1,p2)),"spline is colocated with spline of different length.") |
self.failUnless(not c.isColocated(BSpline(p0,p1,p2)),"spline is colocated with spline of different length.") |
993 |
self.failUnless(not c.isColocated(BSpline(p0,p1,p4,p3)),"spline is colocated with spline with different point.") |
self.failUnless(not c.isColocated(BSpline(p0,p1,p4,p3)),"spline is colocated with spline with different point.") |
1062 |
self.failUnless(c.getStartPoint()==p3, "wrong start point of spline curve") |
self.failUnless(c.getStartPoint()==p3, "wrong start point of spline curve") |
1063 |
self.failUnless(c.getEndPoint()==p0, "wrong end point of spline curve") |
self.failUnless(c.getEndPoint()==p0, "wrong end point of spline curve") |
1064 |
|
|
1065 |
|
self.failUnless(c.hasSameOrientation(c),"has not same orientation like itself") |
1066 |
|
self.failUnless(not c.hasSameOrientation(-c),"has same orientation like -itself") |
1067 |
|
|
1068 |
self.failUnless(not c.isColocated(p1),"spline is colocated with point.") |
self.failUnless(not c.isColocated(p1),"spline is colocated with point.") |
1069 |
self.failUnless(not c.isColocated(BSpline(p0,p1,p2)),"spline is colocated with spline of different length.") |
self.failUnless(not c.isColocated(BSpline(p0,p1,p2)),"spline is colocated with spline of different length.") |
1070 |
self.failUnless(not c.isColocated(BSpline(p0,p1,p4,p3)),"spline is colocated with spline with different point.") |
self.failUnless(not c.isColocated(BSpline(p0,p1,p4,p3)),"spline is colocated with spline with different point.") |
1139 |
self.failUnless(c.getStartPoint()==p0, "wrong start point of spline curve") |
self.failUnless(c.getStartPoint()==p0, "wrong start point of spline curve") |
1140 |
self.failUnless(c.getEndPoint()==p1, "wrong end point of spline curve") |
self.failUnless(c.getEndPoint()==p1, "wrong end point of spline curve") |
1141 |
|
|
1142 |
|
self.failUnless(c.hasSameOrientation(c),"has not same orientation like itself") |
1143 |
|
self.failUnless(not c.hasSameOrientation(-c),"has same orientation like -itself") |
1144 |
|
|
1145 |
self.failUnless(not c.isColocated(p1),"spline is colocated with point.") |
self.failUnless(not c.isColocated(p1),"spline is colocated with point.") |
1146 |
self.failUnless(not c.isColocated(Line(p0,p4)),"spline is colocated with spline with different point.") |
self.failUnless(not c.isColocated(Line(p0,p4)),"spline is colocated with spline with different point.") |
1147 |
self.failUnless(c.isColocated(Line(p0,p1)),"spline is not colocated with spline with same points.") |
self.failUnless(c.isColocated(Line(p0,p1)),"spline is not colocated with spline with same points.") |
1198 |
CC0=Line(p0,p1) |
CC0=Line(p0,p1) |
1199 |
c=-CC0 |
c=-CC0 |
1200 |
|
|
1201 |
|
self.failUnless(c.hasSameOrientation(c),"has not same orientation like itself") |
1202 |
|
self.failUnless(not c.hasSameOrientation(-c),"has same orientation like -itself") |
1203 |
|
|
1204 |
self.failUnless(len(c) == 2, "wrong spline curve length") |
self.failUnless(len(c) == 2, "wrong spline curve length") |
1205 |
self.failUnless(c.getStartPoint()==p1, "wrong start point of spline curve") |
self.failUnless(c.getStartPoint()==p1, "wrong start point of spline curve") |
1206 |
self.failUnless(c.getEndPoint()==p0, "wrong end point of spline curve") |
self.failUnless(c.getEndPoint()==p0, "wrong end point of spline curve") |
1264 |
self.failUnless(c.getStartPoint()==p_start, "wrong start point") |
self.failUnless(c.getStartPoint()==p_start, "wrong start point") |
1265 |
self.failUnless(c.getEndPoint()==p_end, "wrong end point") |
self.failUnless(c.getEndPoint()==p_end, "wrong end point") |
1266 |
|
|
1267 |
|
self.failUnless(c.hasSameOrientation(c),"has not same orientation like itself") |
1268 |
|
self.failUnless(not c.hasSameOrientation(-c),"has same orientation like -itself") |
1269 |
|
|
1270 |
code=c.getGmshCommand() |
code=c.getGmshCommand() |
1271 |
self.failUnless(code == "Circle(6) = {2, 1, 3};", "gmsh command wrong.") |
self.failUnless(code == "Circle(6) = {2, 1, 3};", "gmsh command wrong.") |
1272 |
|
|
1329 |
self.failUnless(c.getStartPoint()==p_end, "wrong start point") |
self.failUnless(c.getStartPoint()==p_end, "wrong start point") |
1330 |
self.failUnless(c.getEndPoint()==p_start, "wrong end point") |
self.failUnless(c.getEndPoint()==p_start, "wrong end point") |
1331 |
|
|
1332 |
|
self.failUnless(c.hasSameOrientation(c),"has not same orientation like itself") |
1333 |
|
self.failUnless(not c.hasSameOrientation(-c),"has same orientation like -itself") |
1334 |
|
|
1335 |
code=c.getGmshCommand() |
code=c.getGmshCommand() |
1336 |
self.failUnless(code == "Circle(6) = {2, 1, 3};", "gmsh command wrong.") |
self.failUnless(code == "Circle(6) = {2, 1, 3};", "gmsh command wrong.") |
1337 |
|
|
1401 |
self.failUnlessRaises(TypeError,ValueError,CurveLoop,l01,l20,l20,msg="douple not detected.") |
self.failUnlessRaises(TypeError,ValueError,CurveLoop,l01,l20,l20,msg="douple not detected.") |
1402 |
self.failUnlessRaises(TypeError,ValueError,CurveLoop,l01,l20,ly,msg="loop detected.") |
self.failUnlessRaises(TypeError,ValueError,CurveLoop,l01,l20,ly,msg="loop detected.") |
1403 |
|
|
1404 |
|
self.failUnless(c.hasSameOrientation(c),"has not same orientation like itself") |
1405 |
|
self.failUnless(not c.hasSameOrientation(-c),"has same orientation like -itself") |
1406 |
|
|
1407 |
code=c.getGmshCommand() |
code=c.getGmshCommand() |
1408 |
self.failUnless(code == "Line Loop(14) = {8, 9, 10};", "gmsh command wrong.") |
self.failUnless(code == "Line Loop(14) = {8, 9, 10};", "gmsh command wrong.") |
1409 |
|
|
|
|
|
1410 |
self.failUnless(not c.isColocated(p4),"CurveLoop is colocated with point.") |
self.failUnless(not c.isColocated(p4),"CurveLoop is colocated with point.") |
1411 |
self.failUnless(c.isColocated(c),"CurveLoop is not colocated with its self.") |
self.failUnless(c.isColocated(c),"CurveLoop is not colocated with its self.") |
1412 |
self.failUnless(c.isColocated(CurveLoop(l01,l12,l20)),"CurveLoop is not colocated with its copy.") |
self.failUnless(c.isColocated(CurveLoop(l01,l12,l20)),"CurveLoop is not colocated with its copy.") |
1473 |
cc=c.getCurves() |
cc=c.getCurves() |
1474 |
self.failUnless(len(cc) == 3, "too many primitives in modified object.") |
self.failUnless(len(cc) == 3, "too many primitives in modified object.") |
1475 |
self.failUnless(l01 in cc,"l01 missed in modified object.") |
self.failUnless(l01 in cc,"l01 missed in modified object.") |
1476 |
|
self.failUnless(cc[cc.index(l01)].hasSameOrientation(l01),"l01 in modified object has wrong orientation.") |
1477 |
self.failUnless(l12 in cc,"l12 missed in modified object.") |
self.failUnless(l12 in cc,"l12 missed in modified object.") |
1478 |
|
self.failUnless(cc[cc.index(l12)].hasSameOrientation(l12),"l12 in modified object has wrong orientation.") |
1479 |
self.failUnless(l20 in cc,"l20 missed in modified object.") |
self.failUnless(l20 in cc,"l20 missed in modified object.") |
1480 |
|
self.failUnless(cc[cc.index(l20)].hasSameOrientation(l20),"l20 in modified object has wrong orientation.") |
1481 |
|
|
1482 |
def test_ReverseCurveLoop(self): |
def test_ReverseCurveLoop(self): |
1483 |
p0=Point(0,0,0,0.1) |
p0=Point(0,0,0,0.1) |
1498 |
CC0=CurveLoop(l01,l20,l12) |
CC0=CurveLoop(l01,l20,l12) |
1499 |
c=-CC0 |
c=-CC0 |
1500 |
|
|
1501 |
|
self.failUnless(c.hasSameOrientation(c),"has not same orientation like itself") |
1502 |
|
self.failUnless(not c.hasSameOrientation(-c),"has same orientation like -itself") |
1503 |
|
|
1504 |
code=c.getGmshCommand() |
code=c.getGmshCommand() |
|
print code |
|
1505 |
self.failUnless(code == "Line Loop(13) = {8, 9, 10};", "gmsh command wrong.") |
self.failUnless(code == "Line Loop(13) = {8, 9, 10};", "gmsh command wrong.") |
1506 |
|
|
1507 |
|
|
1508 |
self.failUnless(not c.isColocated(p4),"CurveLoop is colocated with point.") |
self.failUnless(not c.isColocated(p4),"-CurveLoop is colocated with point.") |
1509 |
self.failUnless(c.isColocated(c),"CurveLoop is not colocated with its self.") |
self.failUnless(c.isColocated(c),"-CurveLoop is not colocated with its self.") |
1510 |
self.failUnless(c.isColocated(CurveLoop(l01,l12,l20)),"CurveLoop is not colocated with its copy.") |
self.failUnless(c.isColocated(CurveLoop(l01,l12,l20)),"-CurveLoop is not colocated with its copy.") |
1511 |
self.failUnless(c.isColocated(CurveLoop(l20,l01,l12)),"CurveLoop is not colocated with its copy with shifted points.") |
self.failUnless(c.isColocated(CurveLoop(l20,l01,l12)),"-CurveLoop is not colocated with its copy with shifted points.") |
1512 |
self.failUnless(c.isColocated(CurveLoop(l20,l12,l01)),"CurveLoop is not colocated with its copy with shuffled points.") |
self.failUnless(c.isColocated(CurveLoop(l20,l12,l01)),"-CurveLoop is not colocated with its copy with shuffled points.") |
1513 |
self.failUnless(not c.isColocated(CurveLoop(lx,ly,l12)),"CurveLoop is colocated with different CurveLoop.") |
self.failUnless(not c.isColocated(CurveLoop(lx,ly,l12)),"-CurveLoop is colocated with different CurveLoop.") |
1514 |
|
|
1515 |
self.failUnless(len(c) == 3, "wrong length") |
self.failUnless(len(c) == 3, "wrong length") |
1516 |
|
|
1539 |
self.failUnless(p4 in p, "p4 is missing") |
self.failUnless(p4 in p, "p4 is missing") |
1540 |
|
|
1541 |
cp=c.copy() |
cp=c.copy() |
1542 |
self.failUnless(isinstance(cp,CurveLoop), "copy returns is not an arc.") |
self.failUnless(isinstance(cp,ReverseCurveLoop), "copy returns is not an ReverseCurveLoop.") |
1543 |
self.failUnless(not cp == c, "copy equals source") |
self.failUnless(not cp == c, "copy equals source") |
1544 |
self.failUnless(cp.isColocated(c),"copy is not colocated with its source.") |
self.failUnless(cp.isColocated(c),"copy is not colocated with its source.") |
1545 |
cc=cp.getCurves() |
cc=cp.getCurves() |
1571 |
cc=c.getCurves() |
cc=c.getCurves() |
1572 |
self.failUnless(len(cc) == 3, "too many primitives in modified object.") |
self.failUnless(len(cc) == 3, "too many primitives in modified object.") |
1573 |
self.failUnless(l01 in cc,"l01 missed in modified object.") |
self.failUnless(l01 in cc,"l01 missed in modified object.") |
1574 |
|
self.failUnless(cc[cc.index(l01)].hasSameOrientation(-l01),"l01 in modified object has wrong orientation.") |
1575 |
self.failUnless(l12 in cc,"l12 missed in modified object.") |
self.failUnless(l12 in cc,"l12 missed in modified object.") |
1576 |
|
self.failUnless(cc[cc.index(l12)].hasSameOrientation(-l12),"l12 in modified object has wrong orientation.") |
1577 |
self.failUnless(l20 in cc,"l20 missed in modified object.") |
self.failUnless(l20 in cc,"l20 missed in modified object.") |
1578 |
|
self.failUnless(cc[cc.index(l20)].hasSameOrientation(-l20),"l20 in modified object has wrong orientation.") |
1579 |
|
|
1580 |
def test_RuledSurface(self): |
def test_RuledSurface(self): |
1581 |
p0=Point(0,0,0,0.1) |
p0=Point(0,0,0,0.1) |
1603 |
|
|
1604 |
cl=s.getBoundaryLoop() |
cl=s.getBoundaryLoop() |
1605 |
self.failUnless(cl == cl1, " wrong boundary loops") |
self.failUnless(cl == cl1, " wrong boundary loops") |
1606 |
|
self.failUnless(cl.hasSameOrientation(cl1),"cl1 has incorrect orientation.") |
1607 |
|
|
1608 |
h=s.getHoles() |
self.failUnless(s.hasSameOrientation(s),"has not same orientation like itself") |
1609 |
self.failUnless(len(h) == 0, "too many holes.") |
self.failUnless(not s.hasSameOrientation(-s),"has same orientation like -itself") |
1610 |
|
|
1611 |
crvs=s.getBoundary() |
crvs=s.getBoundary() |
1612 |
self.failUnless(len(crvs) == 3, "too many boundary corves.") |
self.failUnless(len(crvs) == 3, "too many boundary corves.") |
1613 |
self.failUnless(l01 in crvs, "l01 is missing in boundary") |
self.failUnless(l01 in crvs, "l01 is missing in boundary") |
1614 |
|
self.failUnless(crvs[crvs.index(l01)].hasSameOrientation(l01),"l01 has incorrect orientation.") |
1615 |
self.failUnless(l12_1 in crvs, "l21 is missing in boundary") |
self.failUnless(l12_1 in crvs, "l21 is missing in boundary") |
1616 |
|
self.failUnless(crvs[crvs.index(l12_1)].hasSameOrientation(l12_1),"l12_1 has incorrect orientation.") |
1617 |
self.failUnless(l20 in crvs, "l20 is missing in boundary") |
self.failUnless(l20 in crvs, "l20 is missing in boundary") |
1618 |
|
self.failUnless(crvs[crvs.index(l20)].hasSameOrientation(l20),"l12_1 has incorrect orientation.") |
1619 |
|
|
1620 |
|
|
1621 |
code=s.getGmshCommand() |
code=s.getGmshCommand() |
1705 |
self.failUnless(p3 in p, "inplace dilation p3 is missing") |
self.failUnless(p3 in p, "inplace dilation p3 is missing") |
1706 |
self.failUnless(p4 in p, "inplace dilation p4 is missing") |
self.failUnless(p4 in p, "inplace dilation p4 is missing") |
1707 |
|
|
1708 |
|
p=s.getBoundary() |
1709 |
|
self.failUnless(len(p) == 3, "inplace dilation has too many boundary curves.") |
1710 |
|
self.failUnless(l01 in p, "inplace dilation l01 is missing in boundary curves.") |
1711 |
|
self.failUnless(p[p.index(l01)].hasSameOrientation(l01),"l01 in getBoundary after dilation has incorrect orientation.") |
1712 |
|
self.failUnless(l12_1 in p, "inplace dilation l21 is missing") |
1713 |
|
self.failUnless(p[p.index(l12_1)].hasSameOrientation(l12_1),"l12_1 in getBoundary after dilation has incorrect orientation.") |
1714 |
|
self.failUnless(l20 in p, "inplace dilation l20 is missing") |
1715 |
|
self.failUnless(p[p.index(l20)].hasSameOrientation(l20),"l20 in getBoundary after dilation has incorrect orientation.") |
1716 |
|
|
1717 |
|
p=s.getBoundaryLoop() |
1718 |
|
self.failUnless(cl1 == p, "inplace dilation s.getBoundaryLoop does not return cl1") |
1719 |
|
self.failUnless(p.hasSameOrientation(cl1),"cl1 in getBoundaryLoop after dilation has incorrect orientation.") |
1720 |
|
|
1721 |
|
def test_ReverseRuledSurface(self): |
1722 |
|
p0=Point(0,0,0,0.1) |
1723 |
|
p1=Point(1,1,1,0.2) |
1724 |
|
p2=Point(2,2,2,0.3) |
1725 |
|
p3=Point(3,3,3,0.4) |
1726 |
|
p4=Point(1,2,3) |
1727 |
|
p5=Point(10,20,3) |
1728 |
|
p6=Point(1,2,30) |
1729 |
|
|
1730 |
|
l01=Line(p0,p1) |
1731 |
|
l12_1=Arc(p3,p1,p2) |
1732 |
|
l12_2_1=Spline(p1,p3,p4) |
1733 |
|
l12_2_2=Spline(p4,p5,p2) |
1734 |
|
l12_3=Line(p1,p2) |
1735 |
|
l20=Spline(p2,p4,p0) |
1736 |
|
|
1737 |
|
cl1=CurveLoop(l01,l12_1,l20) |
1738 |
|
cl2=CurveLoop(l01,l12_2_1,l12_2_2,l20) |
1739 |
|
cl3=CurveLoop(l01,l12_3,l20) |
1740 |
|
|
1741 |
|
self.failUnlessRaises(TypeError,ValueError,RuledSurface,l01,msg="non CurveLoop argument accepted.") |
1742 |
|
|
1743 |
|
CC0=RuledSurface(cl1) |
1744 |
|
s=-CC0 |
1745 |
|
|
1746 |
|
cl=s.getBoundaryLoop() |
1747 |
|
self.failUnless(cl == cl1, " wrong boundary loops") |
1748 |
|
self.failUnless(cl.hasSameOrientation(-cl1),"cl1 has incorrect orientation.") |
1749 |
|
|
1750 |
|
self.failUnless(s.hasSameOrientation(s),"has not same orientation like itself") |
1751 |
|
self.failUnless(not s.hasSameOrientation(-s),"has same orientation like -itself") |
1752 |
|
|
1753 |
|
crvs=s.getBoundary() |
1754 |
|
self.failUnless(len(crvs) == 3, "too many boundary corves.") |
1755 |
|
self.failUnless(l01 in crvs, "l01 is missing in boundary") |
1756 |
|
self.failUnless(crvs[crvs.index(l01)].hasSameOrientation(-l01),"l01 has incorrect orientation.") |
1757 |
|
self.failUnless(l12_1 in crvs, "l21 is missing in boundary") |
1758 |
|
self.failUnless(crvs[crvs.index(l12_1)].hasSameOrientation(-l12_1),"l12_1 has incorrect orientation.") |
1759 |
|
self.failUnless(l20 in crvs, "l20 is missing in boundary") |
1760 |
|
self.failUnless(crvs[crvs.index(l20)].hasSameOrientation(-l20),"l12_1 has incorrect orientation.") |
1761 |
|
|
1762 |
|
|
1763 |
|
code=s.getGmshCommand() |
1764 |
|
self.failUnless(code == "Ruled Surface(17) = {14};", "gmsh command wrong.") |
1765 |
|
|
1766 |
|
self.failUnless(not s.isColocated(p4),"RuledSurface is colocated with point.") |
1767 |
|
self.failUnless(s.isColocated(s),"RuledSurface is not colocated with its self.") |
1768 |
|
self.failUnless(s.isColocated(RuledSurface(cl1)),"RuledSurface is not colocated with its copy.") |
1769 |
|
self.failUnless(not s.isColocated(RuledSurface(cl2)),"RuledSurface is colocated with different length") |
1770 |
|
self.failUnless(not s.isColocated(RuledSurface(cl3)),"RuledSurface is colocated with same length.") |
1771 |
|
|
1772 |
|
s.setLocalScale(3.) |
1773 |
|
self.failUnless(p0.getLocalScale()==3., "p0 has wrong local scale.") |
1774 |
|
self.failUnless(p1.getLocalScale()==3., "p1 has wrong local scale.") |
1775 |
|
self.failUnless(p2.getLocalScale()==3., "p2 has wrong local scale.") |
1776 |
|
self.failUnless(p4.getLocalScale()==3., "p4 has wrong local scale.") |
1777 |
|
|
1778 |
|
p=s.getPrimitives() |
1779 |
|
self.failUnless(len(p) == 10, "too many primitives.") |
1780 |
|
self.failUnless(cl1 in p, "cl1 is missing") |
1781 |
|
self.failUnless(l01 in p, "l01 is missing") |
1782 |
|
self.failUnless(l12_1 in p, "l21 is missing") |
1783 |
|
self.failUnless(l20 in p, "l20 is missing") |
1784 |
|
self.failUnless(p0 in p, "p0 is missing") |
1785 |
|
self.failUnless(p1 in p, "p1 is missing") |
1786 |
|
self.failUnless(p2 in p, "p2 is missing") |
1787 |
|
self.failUnless(p3 in p, "p3 is missing") |
1788 |
|
self.failUnless(p4 in p, "p4 is missing") |
1789 |
|
|
1790 |
|
sp=s.copy() |
1791 |
|
self.failUnless(isinstance(sp,ReverseRuledSurface), "copy returns is not a RuledSurface.") |
1792 |
|
self.failUnless(not sp == s, "copy equals source") |
1793 |
|
self.failUnless(sp.isColocated(s),"copy is not colocated with its source.") |
1794 |
|
cbl=sp.getBoundaryLoop() |
1795 |
|
self.failUnless(not cbl == cl1,"copy uses cl1.") |
1796 |
|
cp=sp.getPrimitives() |
1797 |
|
self.failUnless(len(cp) == 10, "copy as too many primitives.") |
1798 |
|
self.failUnless(not cl1 in cp, "copy is using cl1") |
1799 |
|
self.failUnless(not l01 in cp, "copy is using l01") |
1800 |
|
self.failUnless(not l12_1 in cp, "copy is using l21") |
1801 |
|
self.failUnless(not l20 in cp, "copy is using l20") |
1802 |
|
self.failUnless(not p0 in cp, "copy is using p0") |
1803 |
|
self.failUnless(not p1 in cp, "copy is using p1") |
1804 |
|
self.failUnless(not p2 in cp, "copy is using p2") |
1805 |
|
self.failUnless(not p3 in cp, "copy is using p3") |
1806 |
|
self.failUnless(not p4 in cp, "copy is using p4") |
1807 |
|
del cp |
1808 |
|
|
1809 |
|
p0_m=Point(0,0,0) |
1810 |
|
p1_m=Point(-1,-1,-1) |
1811 |
|
p2_m=Point(-2,-2,-2) |
1812 |
|
p3_m=Point(-3,-3,-3) |
1813 |
|
p4_m=Point(-1,-2,-3) |
1814 |
|
|
1815 |
|
l01_m=Line(p0_m,p1_m) |
1816 |
|
l12_m=Arc(p3_m,p1_m,p2_m) |
1817 |
|
l20_m=Spline(p2_m,p4_m,p0_m) |
1818 |
|
|
1819 |
|
ds=s.apply(Dilation(-1.)) |
1820 |
|
self.failUnless(ds.isColocated(RuledSurface(CurveLoop(l01_m,l12_m,l20_m))),"dilation is wrong.") |
1821 |
|
cbl=ds.getBoundaryLoop() |
1822 |
|
self.failUnless(not cbl == cl1,"dilation uses cl1.") |
1823 |
|
cp=ds.getPrimitives() |
1824 |
|
self.failUnless(len(cp) == 10, "dilation as too many primitives.") |
1825 |
|
self.failUnless(not cl1 in cp, "dilation is using cl1") |
1826 |
|
self.failUnless(not l01 in cp, "dilation is using l01") |
1827 |
|
self.failUnless(not l12_1 in cp, "dilation is using l21") |
1828 |
|
self.failUnless(not l20 in cp, "dilation is using l20") |
1829 |
|
self.failUnless(not p0 in cp, "dilation is using p0") |
1830 |
|
self.failUnless(not p1 in cp, "dilation is using p1") |
1831 |
|
self.failUnless(not p2 in cp, "dilation is using p2") |
1832 |
|
self.failUnless(not p3 in cp, "dilation is using p3") |
1833 |
|
self.failUnless(not p4 in cp, "dilation is using p4") |
1834 |
|
|
1835 |
|
s.modifyBy(Dilation(-1.)) |
1836 |
|
self.failUnless(s.isColocated(RuledSurface(CurveLoop(l01_m,l12_m,l20_m))),"inplace dilation is wrong.") |
1837 |
|
|
1838 |
|
p=s.getPrimitives() |
1839 |
|
self.failUnless(len(p) == 10, "inplace dilation has too many primitives.") |
1840 |
|
self.failUnless(cl1 in p, "inplace dilation cl1 is missing") |
1841 |
|
self.failUnless(l01 in p, "inplace dilation l01 is missing") |
1842 |
|
self.failUnless(l12_1 in p, "inplace dilation l21 is missing") |
1843 |
|
self.failUnless(l20 in p, "inplace dilation l20 is missing") |
1844 |
|
self.failUnless(p0 in p, "inplace dilation p0 is missing") |
1845 |
|
self.failUnless(p1 in p, "inplace dilation p1 is missing") |
1846 |
|
self.failUnless(p2 in p, "inplace dilation p2 is missing") |
1847 |
|
self.failUnless(p3 in p, "inplace dilation p3 is missing") |
1848 |
|
self.failUnless(p4 in p, "inplace dilation p4 is missing") |
1849 |
|
|
1850 |
|
p=s.getBoundary() |
1851 |
|
self.failUnless(len(p) == 3, "inplace dilation has too many boundary curves.") |
1852 |
|
self.failUnless(l01 in p, "inplace dilation l01 is missing in boundary curves.") |
1853 |
|
self.failUnless(p[p.index(l01)].hasSameOrientation(-l01),"l01 in getBoundary after dilation has incorrect orientation.") |
1854 |
|
self.failUnless(l12_1 in p, "inplace dilation l21 is missing") |
1855 |
|
self.failUnless(p[p.index(l12_1)].hasSameOrientation(-l12_1),"l12_1 in getBoundary after dilation has incorrect orientation.") |
1856 |
|
self.failUnless(l20 in p, "inplace dilation l20 is missing") |
1857 |
|
self.failUnless(p[p.index(l20)].hasSameOrientation(-l20),"l20 in getBoundary after dilation has incorrect orientation.") |
1858 |
|
|
1859 |
|
p=s.getBoundaryLoop() |
1860 |
|
self.failUnless(cl1 == p, "inplace dilation s.getBoundaryLoop does not return cl1") |
1861 |
|
self.failUnless(p.hasSameOrientation(-cl1),"cl1 in getBoundaryLoop after dilation has incorrect orientation.") |
1862 |
|
|
1863 |
|
|
1864 |
def test_PlaneSurface(self): |
def test_PlaneSurface(self): |
1865 |
p0=Point(0,0,0,0.1) |
p0=Point(0,0,0,0.1) |
1866 |
p1=Point(10,0,0,0.2) |
p1=Point(10,0,0,0.2) |
1902 |
|
|
1903 |
s=PlaneSurface(cl,holes=[h]) |
s=PlaneSurface(cl,holes=[h]) |
1904 |
|
|
1905 |
cl=s.getBoundaryLoop() |
cl2=s.getBoundaryLoop() |
1906 |
self.failUnless(cl == cl, " wrong boundary loops") |
self.failUnless(cl == cl2, " wrong boundary loops") |
1907 |
|
self.failUnless(cl.hasSameOrientation(cl2),"cl has incorrect orientation.") |
1908 |
|
|
1909 |
hs=s.getHoles() |
hs=s.getHoles() |
1910 |
self.failUnless(len(hs) == 1, "one holes expected.") |
self.failUnless(len(hs) == 1, "one holes expected.") |
1911 |
self.failUnless(h in hs, "h is not defined as hole.") |
self.failUnless(h==hs[0], "h is not defined as hole.") |
1912 |
|
self.failUnless(hs[0].hasSameOrientation(h),"hs has incorrect orientation.") |
1913 |
|
|
1914 |
|
self.failUnless(s.hasSameOrientation(s),"has not same orientation like itself") |
1915 |
|
self.failUnless(not s.hasSameOrientation(-s),"has same orientation like -itself") |
1916 |
|
|
1917 |
crvs=s.getBoundary() |
crvs=s.getBoundary() |
1918 |
self.failUnless(len(crvs) == 7, "too many boundary corves.") |
self.failUnless(len(crvs) == 7, "too many boundary corves.") |
1919 |
self.failUnless(l0 in crvs, "l0 is missing in boundary") |
self.failUnless(l0 in crvs, "l0 is missing in boundary") |
1920 |
|
self.failUnless(crvs[crvs.index(l0)].hasSameOrientation(l0),"l0 has incorrect orientation.") |
1921 |
self.failUnless(l1 in crvs, "l1 is missing in boundary") |
self.failUnless(l1 in crvs, "l1 is missing in boundary") |
1922 |
|
self.failUnless(crvs[crvs.index(l1)].hasSameOrientation(l1),"l1 has incorrect orientation.") |
1923 |
self.failUnless(l2 in crvs, "l2 is missing in boundary") |
self.failUnless(l2 in crvs, "l2 is missing in boundary") |
1924 |
|
self.failUnless(crvs[crvs.index(l2)].hasSameOrientation(l2),"l2 has incorrect orientation.") |
1925 |
self.failUnless(l3 in crvs, "l3 is missing in boundary") |
self.failUnless(l3 in crvs, "l3 is missing in boundary") |
1926 |
|
self.failUnless(crvs[crvs.index(l3)].hasSameOrientation(l3),"l3 has incorrect orientation.") |
1927 |
self.failUnless(l4 in crvs, "l4 is missing in boundary") |
self.failUnless(l4 in crvs, "l4 is missing in boundary") |
1928 |
|
self.failUnless(crvs[crvs.index(l4)].hasSameOrientation(l4),"l4 has incorrect orientation.") |
1929 |
self.failUnless(l5 in crvs, "l5 is missing in boundary") |
self.failUnless(l5 in crvs, "l5 is missing in boundary") |
1930 |
|
self.failUnless(crvs[crvs.index(l5)].hasSameOrientation(l5),"l5 has incorrect orientation.") |
1931 |
self.failUnless(l6 in crvs, "l6 is missing in boundary") |
self.failUnless(l6 in crvs, "l6 is missing in boundary") |
1932 |
|
self.failUnless(crvs[crvs.index(l6)].hasSameOrientation(l6),"l6 has incorrect orientation.") |
1933 |
|
|
1934 |
code=s.getGmshCommand() |
code=s.getGmshCommand() |
1935 |
self.failUnless(code == "Plane Surface(29) = {23, 24};", "gmsh command wrong.") |
self.failUnless(code == "Plane Surface(29) = {23, 24};", "gmsh command wrong.") |
2052 |
self.failUnless(s.isColocated(PlaneSurface(cl_m,holes=[h_m])),"inplace dilation is wrong.") |
self.failUnless(s.isColocated(PlaneSurface(cl_m,holes=[h_m])),"inplace dilation is wrong.") |
2053 |
cbl=s.getBoundaryLoop() |
cbl=s.getBoundaryLoop() |
2054 |
self.failUnless(cbl == cl,"inplace dilation does not use cl1.") |
self.failUnless(cbl == cl,"inplace dilation does not use cl1.") |
2055 |
|
self.failUnless(cl.hasSameOrientation(cbl),"cl has incorrect orientation.") |
2056 |
|
hs=s.getHoles() |
2057 |
|
self.failUnless(len(hs)==1,"inplace dilation is missing holes.") |
2058 |
|
self.failUnless(hs[0]== h,"inplace dilation must contain h as a hole.") |
2059 |
|
self.failUnless(hs[0].hasSameOrientation(h),"hole in inplace dilation has incorrect orientation.") |
2060 |
|
|
2061 |
|
cp=s.getPrimitives() |
2062 |
|
self.failUnless(len(cp) == 17, "inplace dilation as too many primitives.") |
2063 |
|
self.failUnless(s in cp, "inplace dilation must use s") |
2064 |
|
self.failUnless(cl in cp, "inplace dilation must use cl") |
2065 |
|
self.failUnless(h in cp, "inplace dilation must use h") |
2066 |
|
self.failUnless(l0 in cp, "inplace dilation must use l0") |
2067 |
|
self.failUnless(l1 in cp, "inplace dilation must use l1") |
2068 |
|
self.failUnless(l2 in cp, "inplace dilation must use l2") |
2069 |
|
self.failUnless(l3 in cp, "inplace dilation must use l3") |
2070 |
|
self.failUnless(l4 in cp, "inplace dilation must use l4") |
2071 |
|
self.failUnless(l5 in cp, "inplace dilation must use l5") |
2072 |
|
self.failUnless(l6 in cp, "inplace dilation must use l6") |
2073 |
|
self.failUnless(p0 in cp, "inplace dilation must use p0") |
2074 |
|
self.failUnless(p1 in cp, "inplace dilation must use p1") |
2075 |
|
self.failUnless(p2 in cp, "inplace dilation must use p2") |
2076 |
|
self.failUnless(p3 in cp, "inplace dilation must use p3") |
2077 |
|
self.failUnless(p4 in cp, "inplace dilation must use p4") |
2078 |
|
self.failUnless(p5 in cp, "inplace dilation must use p5") |
2079 |
|
self.failUnless(p6 in cp, "inplace dilation must use p6") |
2080 |
|
|
2081 |
|
def test_PlaneSurface(self): |
2082 |
|
p0=Point(0,0,0,0.1) |
2083 |
|
p1=Point(10,0,0,0.2) |
2084 |
|
p2=Point(10,10,0,0.3) |
2085 |
|
p3=Point(0,10,3,0.4) |
2086 |
|
p4=Point(5,5,0,0.001) |
2087 |
|
p5=Point(7,5,0,0.001) |
2088 |
|
p6=Point(5,7,0,0.001) |
2089 |
|
p7=Point(8,8,0,0.001) |
2090 |
|
p8=Point(9,9,0,0.001) |
2091 |
|
|
2092 |
|
l0=Line(p0,p1) |
2093 |
|
l1=Line(p1,p2) |
2094 |
|
l2=Line(p2,p3) |
2095 |
|
l3=Line(p3,p0) |
2096 |
|
|
2097 |
|
l9=Line(p1,p8) |
2098 |
|
l10=Line(p8,p3) |
2099 |
|
|
2100 |
|
l4=Line(p4,p5) |
2101 |
|
l5=Line(p5,p6) |
2102 |
|
l6=Line(p6,p4) |
2103 |
|
l7=Line(p6,p7) |
2104 |
|
l8=Line(p7,p4) |
2105 |
|
|
2106 |
|
a1=Arc(p4,p3,p1) |
2107 |
|
a2=Arc(p7,p5,p6) |
2108 |
|
|
2109 |
|
cl=CurveLoop(l0,l1,l2,l3) |
2110 |
|
h=CurveLoop(l4,l5,l6) |
2111 |
|
cl_s=CurveLoop(l0,l9,l10,l3) |
2112 |
|
h2=CurveLoop(l4,l5,l7,l8) |
2113 |
|
cl_a=CurveLoop(a1,l1,l2) |
2114 |
|
h_a=CurveLoop(a2,l6,l4) |
2115 |
|
|
2116 |
|
self.failUnlessRaises(TypeError,ValueError,PlaneSurface,l4,msg="non CurveLoop argument accepted.") |
2117 |
|
self.failUnlessRaises(TypeError,ValueError,PlaneSurface,cl_a,h,msg="CurveLoop with no line curves accepted.") |
2118 |
|
self.failUnlessRaises(TypeError,ValueError,PlaneSurface,cl,[h_a],msg="CurveLoop with no line curves as holes accepted.") |
2119 |
|
|
2120 |
|
CC0=PlaneSurface(cl,holes=[h]) |
2121 |
|
s=-CC0 |
2122 |
|
|
2123 |
|
cl2=s.getBoundaryLoop() |
2124 |
|
self.failUnless(cl == cl2, " wrong boundary loops") |
2125 |
|
self.failUnless(cl.hasSameOrientation(-cl2),"cl has incorrect orientation.") |
2126 |
|
|
2127 |
|
hs=s.getHoles() |
2128 |
|
self.failUnless(len(hs) == 1, "one holes expected.") |
2129 |
|
self.failUnless(h==hs[0], "h is not defined as hole.") |
2130 |
|
self.failUnless(hs[0].hasSameOrientation(-h),"hs has incorrect orientation.") |
2131 |
|
|
2132 |
|
self.failUnless(s.hasSameOrientation(s),"has not same orientation like itself") |
2133 |
|
self.failUnless(not s.hasSameOrientation(-s),"has same orientation like -itself") |
2134 |
|
|
2135 |
|
crvs=s.getBoundary() |
2136 |
|
self.failUnless(len(crvs) == 7, "too many boundary corves.") |
2137 |
|
self.failUnless(l0 in crvs, "l0 is missing in boundary") |
2138 |
|
self.failUnless(crvs[crvs.index(l0)].hasSameOrientation(-l0),"l0 has incorrect orientation.") |
2139 |
|
self.failUnless(l1 in crvs, "l1 is missing in boundary") |
2140 |
|
self.failUnless(crvs[crvs.index(l1)].hasSameOrientation(-l1),"l1 has incorrect orientation.") |
2141 |
|
self.failUnless(l2 in crvs, "l2 is missing in boundary") |
2142 |
|
self.failUnless(crvs[crvs.index(l2)].hasSameOrientation(-l2),"l2 has incorrect orientation.") |
2143 |
|
self.failUnless(l3 in crvs, "l3 is missing in boundary") |
2144 |
|
self.failUnless(crvs[crvs.index(l3)].hasSameOrientation(-l3),"l3 has incorrect orientation.") |
2145 |
|
self.failUnless(l4 in crvs, "l4 is missing in boundary") |
2146 |
|
self.failUnless(crvs[crvs.index(l4)].hasSameOrientation(-l4),"l4 has incorrect orientation.") |
2147 |
|
self.failUnless(l5 in crvs, "l5 is missing in boundary") |
2148 |
|
self.failUnless(crvs[crvs.index(l5)].hasSameOrientation(-l5),"l5 has incorrect orientation.") |
2149 |
|
self.failUnless(l6 in crvs, "l6 is missing in boundary") |
2150 |
|
self.failUnless(crvs[crvs.index(l6)].hasSameOrientation(-l6),"l6 has incorrect orientation.") |
2151 |
|
|
2152 |
|
code=s.getGmshCommand() |
2153 |
|
self.failUnless(code == "Plane Surface(29) = {23, 24};", "gmsh command wrong.") |
2154 |
|
|
2155 |
|
self.failUnless(not s.isColocated(p4),"PlaneSurface is colocated with point.") |
2156 |
|
self.failUnless(s.isColocated(s),"PlaneSurface is not colocated with its self.") |
2157 |
|
self.failUnless(s.isColocated(PlaneSurface(cl,holes=[h])),"PlaneSurface is not colocated with its copy.") |
2158 |
|
self.failUnless(not s.isColocated(PlaneSurface(cl)),"PlaneSurface is colocated with PlaneSurface with same boundary but no hole") |
2159 |
|
self.failUnless(not s.isColocated(PlaneSurface(cl_s,holes=[h])),"PlaneSurface is colocated with PlaneSurface with deformed boundary") |
2160 |
|
self.failUnless(not s.isColocated(PlaneSurface(cl,holes=[h2])),"PlaneSurface is colocated with modified hole") |
2161 |
|
|
2162 |
|
s.setLocalScale(3.) |
2163 |
|
self.failUnless(p0.getLocalScale()==3., "p0 has wrong local scale.") |
2164 |
|
self.failUnless(p1.getLocalScale()==3., "p1 has wrong local scale.") |
2165 |
|
self.failUnless(p2.getLocalScale()==3., "p2 has wrong local scale.") |
2166 |
|
self.failUnless(p3.getLocalScale()==3., "p3 has wrong local scale.") |
2167 |
|
self.failUnless(p4.getLocalScale()==3., "p4 has wrong local scale.") |
2168 |
|
self.failUnless(p5.getLocalScale()==3., "p5 has wrong local scale.") |
2169 |
|
self.failUnless(p6.getLocalScale()==3., "p6 has wrong local scale.") |
2170 |
|
|
2171 |
|
p=s.getPrimitives() |
2172 |
|
self.failUnless(len(p) == 17, "too many primitives.") |
2173 |
|
self.failUnless(s in p, "cl is missing") |
2174 |
|
self.failUnless(cl in p, "cl is missing") |
2175 |
|
self.failUnless(h in p, "h is missing") |
2176 |
|
self.failUnless(l0 in p, "l0 is missing") |
2177 |
|
self.failUnless(l1 in p, "l1 is missing") |
2178 |
|
self.failUnless(l2 in p, "l2 is missing") |
2179 |
|
self.failUnless(l3 in p, "l3 is missing") |
2180 |
|
self.failUnless(l4 in p, "l4 is missing") |
2181 |
|
self.failUnless(l5 in p, "l5 is missing") |
2182 |
|
self.failUnless(l6 in p, "l6 is missing") |
2183 |
|
self.failUnless(p0 in p, "p0 is missing") |
2184 |
|
self.failUnless(p1 in p, "p1 is missing") |
2185 |
|
self.failUnless(p2 in p, "p2 is missing") |
2186 |
|
self.failUnless(p3 in p, "p3 is missing") |
2187 |
|
self.failUnless(p4 in p, "p4 is missing") |
2188 |
|
self.failUnless(p5 in p, "p5 is missing") |
2189 |
|
self.failUnless(p6 in p, "p6 is missing") |
2190 |
|
|
2191 |
|
sp=s.copy() |
2192 |
|
self.failUnless(isinstance(sp,ReversePlaneSurface), "copy returns is not a PlaneSurface.") |
2193 |
|
self.failUnless(not sp == s, "copy equals source") |
2194 |
|
self.failUnless(sp.isColocated(s),"copy is not colocated with its source.") |
2195 |
|
cbl=sp.getBoundaryLoop() |
2196 |
|
self.failUnless(not cbl == cl,"copy uses cl1.") |
2197 |
|
hs=sp.getHoles() |
2198 |
|
self.failUnless(len(hs)==1,"copy is missing holes.") |
2199 |
|
self.failUnless(not hs[0]== h,"copy contains h as a hole.") |
2200 |
|
cp=sp.getPrimitives() |
2201 |
|
self.failUnless(len(cp) == 17, "copy as too many primitives.") |
2202 |
|
self.failUnless(not s in cp, "copy contains s") |
2203 |
|
self.failUnless(not cl in cp, "copy contains cl") |
2204 |
|
self.failUnless(not h in cp, "copy contains h") |
2205 |
|
self.failUnless(not l0 in cp, "copy contains l0") |
2206 |
|
self.failUnless(not l1 in cp, "copy contains l1") |
2207 |
|
self.failUnless(not l2 in cp, "copy contains l2") |
2208 |
|
self.failUnless(not l3 in cp, "copy contains l3") |
2209 |
|
self.failUnless(not l4 in cp, "copy contains l4") |
2210 |
|
self.failUnless(not l5 in cp, "copy contains l5") |
2211 |
|
self.failUnless(not l6 in cp, "copy contains l6") |
2212 |
|
self.failUnless(not p0 in cp, "copy contains p0") |
2213 |
|
self.failUnless(not p1 in cp, "copy contains p1") |
2214 |
|
self.failUnless(not p2 in cp, "copy contains p2") |
2215 |
|
self.failUnless(not p3 in cp, "copy contains p3") |
2216 |
|
self.failUnless(not p4 in cp, "copy contains p4") |
2217 |
|
self.failUnless(not p5 in cp, "copy contains p5") |
2218 |
|
self.failUnless(not p6 in cp, "copy contains p6") |
2219 |
|
del sp |
2220 |
|
|
2221 |
|
|
2222 |
|
p0_m=Point(0,0,0,0.1) |
2223 |
|
p1_m=Point(-10,0,0,0.2) |
2224 |
|
p2_m=Point(-10,-10,0,0.3) |
2225 |
|
p3_m=Point(0,-10,-3,0.4) |
2226 |
|
p4_m=Point(-5,-5,0,0.001) |
2227 |
|
p5_m=Point(-7,-5,0,0.001) |
2228 |
|
p6_m=Point(-5,-7,0,0.001) |
2229 |
|
|
2230 |
|
l0_m=Line(p0_m,p1_m) |
2231 |
|
l1_m=Line(p1_m,p2_m) |
2232 |
|
l2_m=Line(p2_m,p3_m) |
2233 |
|
l3_m=Line(p3_m,p0_m) |
2234 |
|
|
2235 |
|
l4_m=Line(p4_m,p5_m) |
2236 |
|
l5_m=Line(p5_m,p6_m) |
2237 |
|
l6_m=Line(p6_m,p4_m) |
2238 |
|
|
2239 |
|
cl_m=CurveLoop(l0_m,l1_m,l2_m,l3_m) |
2240 |
|
h_m=CurveLoop(l4_m,l5_m,l6_m) |
2241 |
|
|
2242 |
|
ds=s.apply(Dilation(-1.)) |
2243 |
|
self.failUnless(ds.isColocated(PlaneSurface(cl_m,holes=[h_m])),"dilation is wrong.") |
2244 |
|
cbl=ds.getBoundaryLoop() |
2245 |
|
self.failUnless(not cbl == cl,"dilation uses cl1.") |
2246 |
|
hs=ds.getHoles() |
2247 |
|
self.failUnless(len(hs)==1,"dilation is missing holes.") |
2248 |
|
self.failUnless(not hs[0]== h,"dilation contains h as a hole.") |
2249 |
|
cp=ds.getPrimitives() |
2250 |
|
self.failUnless(len(cp) == 17, "dilation as too many primitives.") |
2251 |
|
self.failUnless(not s in cp, "dilation contains s") |
2252 |
|
self.failUnless(not cl in cp, "dilation contains cl") |
2253 |
|
self.failUnless(not h in cp, "dilation contains h") |
2254 |
|
self.failUnless(not l0 in cp, "dilation contains l0") |
2255 |
|
self.failUnless(not l1 in cp, "dilation contains l1") |
2256 |
|
self.failUnless(not l2 in cp, "dilation contains l2") |
2257 |
|
self.failUnless(not l3 in cp, "dilation contains l3") |
2258 |
|
self.failUnless(not l4 in cp, "dilation contains l4") |
2259 |
|
self.failUnless(not l5 in cp, "dilation contains l5") |
2260 |
|
self.failUnless(not l6 in cp, "dilation contains l6") |
2261 |
|
self.failUnless(not p0 in cp, "dilation contains p0") |
2262 |
|
self.failUnless(not p1 in cp, "dilation contains p1") |
2263 |
|
self.failUnless(not p2 in cp, "dilation contains p2") |
2264 |
|
self.failUnless(not p3 in cp, "dilation contains p3") |
2265 |
|
self.failUnless(not p4 in cp, "dilation contains p4") |
2266 |
|
self.failUnless(not p5 in cp, "dilation contains p5") |
2267 |
|
self.failUnless(not p6 in cp, "dilation contains p6") |
2268 |
|
|
2269 |
|
s.modifyBy(Dilation(-1.)) |
2270 |
|
self.failUnless(s.isColocated(PlaneSurface(cl_m,holes=[h_m])),"inplace dilation is wrong.") |
2271 |
|
cbl=s.getBoundaryLoop() |
2272 |
|
self.failUnless(cbl == cl,"inplace dilation does not use cl1.") |
2273 |
|
self.failUnless(cl.hasSameOrientation(-cbl),"cl has incorrect orientation.") |
2274 |
hs=s.getHoles() |
hs=s.getHoles() |
2275 |
self.failUnless(len(hs)==1,"inplace dilation is missing holes.") |
self.failUnless(len(hs)==1,"inplace dilation is missing holes.") |
2276 |
self.failUnless(hs[0]== h,"inplace dilation must contain h as a hole.") |
self.failUnless(hs[0]== h,"inplace dilation must contain h as a hole.") |
2277 |
|
self.failUnless(hs[0].hasSameOrientation(-h),"hole in inplace dilation has incorrect orientation.") |
2278 |
|
|
2279 |
cp=s.getPrimitives() |
cp=s.getPrimitives() |
2280 |
self.failUnless(len(cp) == 17, "inplace dilation as too many primitives.") |
self.failUnless(len(cp) == 17, "inplace dilation as too many primitives.") |
2281 |
self.failUnless(s in cp, "inplace dilation must use s") |
self.failUnless(s in cp, "inplace dilation must use s") |
2296 |
self.failUnless(p5 in cp, "inplace dilation must use p5") |
self.failUnless(p5 in cp, "inplace dilation must use p5") |
2297 |
self.failUnless(p6 in cp, "inplace dilation must use p6") |
self.failUnless(p6 in cp, "inplace dilation must use p6") |
2298 |
|
|
2299 |
def test_SurfaceLoop(self): |
def stest_SurfaceLoop(self): |
2300 |
p0=Point( 0, 0, 0,0.1) |
p0=Point( 0, 0, 0,0.1) |
2301 |
p1=Point(10, 0, 0,0.1) |
p1=Point(10, 0, 0,0.1) |
2302 |
p2=Point( 0,10, 0,0.1) |
p2=Point( 0,10, 0,0.1) |
2320 |
l54=Line(p5,p4) |
l54=Line(p5,p4) |
2321 |
l04=Line(p4,p0) |
l04=Line(p4,p0) |
2322 |
|
|
2323 |
l31=Line(p3,p1) |
l13=Line(p1,p3) |
2324 |
l57=Line(p3,p1) |
l37=Line(p3,p7) |
2325 |
|
l75=Line(p7,p5) |
2326 |
|
l67=Line(p6,p7) |
2327 |
|
l26=Line(p2,p6) |
2328 |
|
l32=Line(p3,p2) |
2329 |
|
l20=Line(p2,p0) |
2330 |
|
l46=Line(p4,p6) |
2331 |
|
|
2332 |
m01=Line(q0,q1) |
m01=Line(q0,q1) |
2333 |
m15=Line(q1,q5) |
m15=Line(q1,q5) |
2334 |
m54=Line(q5,q4) |
m54=Line(q5,q4) |
2335 |
m04=Line(q4,q0) |
m40=Line(q4,q0) |
2336 |
|
m23=Line(q2,q3) |
2337 |
|
m37=Line(q3,q7) |
2338 |
|
m76=Line(q7,q6) |
2339 |
|
m62=Line(q6,q2) |
2340 |
|
|
2341 |
cl_l1=CurveLoop(l01,l15,l54,l04) |
cl_l1=CurveLoop(l01,l15,l54,l04) |
2342 |
cl_m1=CurveLoop(m01,m15,m54,m04) |
cl_m1=CurveLoop(m01,m15,m54,m40) |
2343 |
s1=PlaneSurface(cl_l1,holes=[cl_m1]) |
s1=PlaneSurface(cl_l1,holes=[cl_m1]) |
2344 |
|
|
2345 |
|
cl_l2=CurveLoop(-l15,l13,l37,l75) |
2346 |
|
s2=PlaneSurface(cl_l2) |
2347 |
|
|
2348 |
|
cl_l3=CurveLoop(l32,-l37,l67,l26) |
2349 |
|
cl_m3=CurveLoop(-m23,-m37,-m76,-m62) |
2350 |
|
s3=PlaneSurface(cl_l3,holes=[cl_m3]) |
2351 |
|
|
2352 |
|
cl_l4=CurveLoop(l20,-l26,l46,-l04) |
2353 |
|
s4=PlaneSurface(cl_l4) |
2354 |
|
|
2355 |
|
cl_l5=CurveLoop(l32,l20,l01,l13) |
2356 |
|
s5=PlaneSurface(-cl_l5) |
2357 |
|
|
2358 |
|
cl_l6=CurveLoop(l67,l75,l54,l46) |
2359 |
|
s6=PlaneSurface(-cl_l6) |
2360 |
|
|
2361 |
|
x=SurfaceLoop(s1,s2,s3,s4,s5) |
2362 |
|
print x |
2363 |
|
print "X" |
2364 |
|
self.failUnlessRaises(TypeError,SurfaceLoop,s1,s2,s3,s4,s5,msg="broken loop not detecred.") |
2365 |
|
s=SurfaceLoop(s1,s2,s3,s4,s5,s6) |
2366 |
if __name__ == '__main__': |
if __name__ == '__main__': |
2367 |
suite = unittest.TestSuite() |
suite = unittest.TestSuite() |
2368 |
suite.addTest(unittest.makeSuite(Test_PyCAD_Transformations)) |
suite.addTest(unittest.makeSuite(Test_PyCAD_Transformations)) |