def row0(self): """Gets row 0 of this matrix. Returns: Vec3: Row 0 vector. """ return Vec3(self._rtval.row0)
def row2(self): """Gets row 2 of this matrix. Returns: Vec3: row 2 vector. """ return Vec3(self._rtval.row2)
def v(self): """Gets vector of this quaternion. Returns: Vec3: Vector of the quaternion. """ return Vec3(self._rtval.v)
def toEulerAngles(self): """Gets this quaternion as a Euler angles using the rotationorder XYZ. Returns: Vec3: Euler angles derived from this quaternion. """ return Vec3(self._rtval.toEulerAngles('Vec3'))
def getZaxis(self): """Gets the Z axis of this quaternion. Returns: Vec3: Z axis of this quaternion. """ return Vec3(self._rtval.getZaxis('Vec3'))
def multiplyVector(self, other): """Returns the product of this matrix and a vector. Args: other (Vec3): Vector to multiply this matrix by. Returns: Vec3: product of the multiplication of the Vec3 and this matrix. """ return Vec3(self._rtval.multiplyVector('Vec3', ks.rtVal('Vec3', other)))
def rotateVector(self, v): """Rotates a vector by this quaterion. Don't forget to normalize the quaternion unless you want axial translation as well as rotation.. Args: v (Vec3): vector to rotate. Returns: Vec3: New vector rotated by this quaternion. """ return Vec3(self._rtval.rotateVector('Vec3', ks.rtVal('Vec3', v)))
def toEulerAnglesWithRotOrder(self, ro): """Gets this quaternion as Euler angles using the specified rotation order. Args: ro (RotationOrder): rotation order used to derive the euler angles. Returns: Vec3: Euler angles derived from this quaternion. """ return Vec3( self._rtval.toEulerAngles('Vec3', ks.rtVal('RotationOrder', ro)))
def toEulerAngles(self, order): """Gets this quaternion as a Euler angles using the rotationorder XYZ. Args: order (RotationOrder): rotation order used to derive the euler angles. Returns: Vec3: Euler angles derived from this quaternion. """ return Vec3( self._rtval.toEulerAngles('Vec3', ks.rtVal('RotationOrder', rotationOrder)))
def evaluate(self): """invokes the constraint causing the output value to be computed. Returns: bool: True if successful. """ if self.getMaintainOffset() is False: newTr = Vec3(); for constrainer in self.getConstrainers(): newTr = newTr.add(constrainer.xfo.tr) self.getConstrainee().xfo.tr = newTr return True
def evaluate(self): """invokes the constraint causing the output value to be computed. Return: Boolean, True if successful. """ if self.getMaintainOffset() is False: newOri = Quat(); newOri.set(Vec3(), 0.0) for constrainer in self.getConstrainers(): newOri = newOri.add(constrainer.xfo.ori) newOri.setUnit() self.getConstrainee().xfo.ori = newOri return True
def evaluate(self): """invokes the constraint causing the output value to be computed. Returns: bool: True if successful. """ if self.getMaintainOffset() is False: newXfo = Xfo() newXfo.ori.set(Vec3(), 0.0) for constrainer in self.getConstrainers(): newXfo.tr = newXfo.tr.add(constrainer.xfo.tr) newXfo.ori = newXfo.ori.add(constrainer.xfo.ori) newXfo.ori.setUnit() self.getConstrainee().xfo = newXfo return True
def __mirrorData(jsonData, plane): if isinstance(jsonData, Vec3): newVec3 = Vec3(jsonData) if plane == 0: newVec3.x = -newVec3.x elif plane == 1: newVec3.y = -newVec3.y elif plane == 2: newVec3.z = -newVec3.z return newVec3 if isinstance(jsonData, Quat): newQuat = Quat(jsonData) newQuat.mirror(plane) return newQuat elif isinstance(jsonData, Xfo): newXfo = Xfo(jsonData) if plane == 0: newXfo.tr.x = -newXfo.tr.x elif plane == 1: newXfo.tr.y = -newXfo.tr.y elif plane == 2: newXfo.tr.z = -newXfo.tr.z newXfo.ori.mirror(plane) return newXfo elif type(jsonData) is list: newList = [] for item in jsonData: newList.append(__mirrorData(item, plane)) return newList elif type(jsonData) is dict: newDict = {} for key, value in jsonData.iteritems(): newDict[key] = __mirrorData(value, plane) return newDict return jsonData