def CalculateNormal(first, second, third): v1 = Vector3(second.x - first.x, second.y - first.y, second.z - first.z) v2 = Vector3(third.x - second.x, third.y - second.y, third.z - second.z) normal = v1.Cross(v2) normal.Normalize() return normal
def AreCollinear(first, second, third): if (first == second or first == third or second == third): return True v1 = Vector3(first.x - second.x, first.y - second.y, 0) v2 = Vector3(first.x - third.x, first.y - third.y, 0) angle = Vector3.AngleDeg(v1,v2) if ((fabs(angle) < Constants.PRECISION) or (fabs(angle - 180) < Constants.PRECISION)): return True return False
def __sub__(self, other): return Vector3(self.x - other.x, self.y - other.y, self.z - other.z)
def CalculateNormal (first, second, third): v1 = Vector3.Vector3( second.x - first.x, second.y - first.y, 0) normal = Vector3.Vector3(v1.y, -v1.x, 0) normal.Normalize() return print('Normal Vector', normal)