--- trunk/pycad/py_src/transformations.py 2006/11/22 09:54:19 907 +++ trunk/pycad/py_src/transformations.py 2006/12/14 06:12:53 915 @@ -84,10 +84,13 @@ lz_per=numarray.dot(z_per,z_per) if lz_per>0: axis1=z_per/math.sqrt(lz_per) - axis2=_cross(self.__axis,axis1) + axis2=_cross(axis1,self.__axis) lax2=numarray.dot(axis2,axis2) - axis2/=math.sqrt(lax2) - return z0*self.__axis+math.sqrt(lz_per)*(math.cos(self.__angle)*axis1-math.sin(self.__angle)*axis2)+self.__point0 + if lax2>0: + axis2/=math.sqrt(lax2) + return z0*self.__axis+math.sqrt(lz_per)*(math.cos(self.__angle)*axis1-math.sin(self.__angle)*axis2)+self.__point0 + else: + return x else: return x def _cross(x, y): @@ -104,8 +107,8 @@ """ creates a dilation with a center an a given expansion/contraction factor """ - if not factor>0: - raise ValueError("factor must be positive.") + if not abs(factor)>0: + raise ValueError("factor must be non-zero.") self.__factor=factor self.__center=numarray.array(center,type=_TYPE) def __call__(self,x=numarray.zeros((3,))):