/[escript]/trunk/pycad/py_src/primitives.py
ViewVC logotype

Diff of /trunk/pycad/py_src/primitives.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1388 by trankine, Fri Jan 11 07:45:58 2008 UTC revision 1727 by artak, Tue Aug 26 04:19:27 2008 UTC
# Line 39  __url__="http://www.iservo.edu.au/esys/e Line 39  __url__="http://www.iservo.edu.au/esys/e
39  __version__="$Revision:$"  __version__="$Revision:$"
40  __date__="$Date:$"  __date__="$Date:$"
41    
42    try:
43       import numpy
44       numpyImported=True
45    except:
46       numpyImported=False  
47    
48  import numarray  import numarray
49  from transformations import _TYPE, Translation, Dilation, Transformation  from transformations import _TYPE, Translation, Dilation, Transformation
50  from math import sqrt  from math import sqrt
# Line 383  class Point(Primitive, PrimitiveBase): Line 389  class Point(Primitive, PrimitiveBase):
389            primitive=primitive.getCoordinates()            primitive=primitive.getCoordinates()
390            c=self.getCoordinates()            c=self.getCoordinates()
391            d=c-primitive            d=c-primitive
392            return numarray.dot(d,d)<=getToleranceForColocation()**2*max(numarray.dot(c,c),numarray.dot(primitive,primitive))            if numpyImported:
393                return numpy.dot(d,d)<=getToleranceForColocation()**2*max(numpy.dot(c,c),numpy.dot(primitive,primitive))
394              else:
395                return numarray.dot(d,d)<=getToleranceForColocation()**2*max(numarray.dot(c,c),numarray.dot(primitive,primitive))
396         else:         else:
397            return False            return False
398    
# Line 934  class CurveLoop(Primitive, PrimitiveBase Line 943  class CurveLoop(Primitive, PrimitiveBase
943                  cp1=primitive.getCurves()                  cp1=primitive.getCurves()
944                  for c0 in cp0:                  for c0 in cp0:
945                      colocated = False                      colocated = False
946                      for c1 in cp1:                      for c1 in cp1:
947                           colocated = colocated or c0.isColocated(c1)                           colocated = colocated or c0.isColocated(c1)
948                      if not colocated: return False                      if not colocated: return False
949                  return True                  return True
# Line 1261  class SurfaceLoop(Primitive, PrimitiveBa Line 1270  class SurfaceLoop(Primitive, PrimitiveBa
1270                  sp1=primitive.getSurfaces()                  sp1=primitive.getSurfaces()
1271                  for s0 in sp0:                  for s0 in sp0:
1272                      colocated = False                      colocated = False
1273                      for s1 in sp1:                      for s1 in sp1:
1274                           colocated = colocated or s0.isColocated(s1)                           colocated = colocated or s0.isColocated(s1)
1275                      if not colocated: return False                      if not colocated: return False
1276                  return True                  return True

Legend:
Removed from v.1388  
changed lines
  Added in v.1727

  ViewVC Help
Powered by ViewVC 1.1.26