revision 2947 by gross, Mon Feb 15 03:29:53 2010 UTC revision 2948 by gross, Thu Feb 25 04:54:30 2010 UTC
# Line 411  class Point(Primitive, PrimitiveBase): Line 411  class Point(Primitive, PrimitiveBase):
411         """         """
412         return self._x         return self._x
413
414        def getCoordinatesAsList(self):
415           """
416           Returns the coodinates of the point as a ``list`` object.
417           """
418           return [self._x[0], self._x[1], self._x[2] ]
419
420      def setCoordinates(self,x):      def setCoordinates(self,x):
421         """         """
422         Sets the coodinates of the point from a ``numpy.ndarray`` object ``x``.         Sets the coodinates of the point from a ``numpy.ndarray`` object ``x``.
# Line 1071  class CurveLoop(Primitive, PrimitiveBase Line 1077  class CurveLoop(Primitive, PrimitiveBase
1077                  return True                  return True
1078         return False         return False
1079
1080              def getPolygon(self):
1081                 """
1082           Returns a list of start/end points of the 1D mainfold form the loop. If not closed and exception is thrown.
1083           """
1084           curves=self.getCurves()
1085           s=[curves[0].getStartPoint(), curves[0].getEndPoint()]
1086           found= [ curves[0], ]
1087           restart=True
1088           while restart:
1089              restart=False
1090          for k in curves:
1091              if not k in found:
1092              if k.getStartPoint() == s[-1]:
1093                          found.append(k)
1094                          if hasattr(k,"getControlPoints"): s+=k.getControlPoints()[1:-1]
1095                          if k.getEndPoint() == s[0]:
1096                               if len(found) == len(curves):
1097                                 return s
1098                               else:
1099                     raise ValueError,"loop %s is not closed."%self.getID()
1100                  s.append(k.getEndPoint())
1101                  restart=True
1102                  break
1103          if not restart:
1104                   raise ValueError,"loop %s is not closed."%self.getID()
1105
1106  class ReverseCurveLoop(ReversePrimitive, PrimitiveBase):  class ReverseCurveLoop(ReversePrimitive, PrimitiveBase):
1107      """      """
# Line 1264  class Manifold2D(PrimitiveBase): Line 1293  class Manifold2D(PrimitiveBase):
1293                  return (self.__points, self.__orientation)                  return (self.__points, self.__orientation)
1294              else:              else:
1295                  return None                  return None
def getPolygon(self):
"""
Returns a list of start/end points of the 1D mainfold form the loop. If not closed and exception is thrown.
"""
curves=self.getBoundary()
s=[curves[0].getStartPoint(), curves[0].getEndPoint()]
found= [ curves[0] ]
restart=True
while restart:
restart=False
for k in curves:
if not k in found:
if k.getStartPoint() == s[-1]:
found.append(k)
if k.getEndPoint() == s[0]:
if len(found) == len(curves):
return s
else:
raise ValueError,"loop %s is not closed."%self.getID()
s.append(k.getEndPoint())
restart=True
break
if not restart:
raise ValueError,"loop %s is not closed."%self.getID()
1296  class RuledSurface(Primitive, Manifold2D):  class RuledSurface(Primitive, Manifold2D):
1297      """      """
1298      A ruled surface, i.e. a surface that can be interpolated using transfinite      A ruled surface, i.e. a surface that can be interpolated using transfinite

Legend:
 Removed from v.2947 changed lines Added in v.2948