Ejemplo n.º 1
0
    def PlaneFromPointNormal(sourcePoint, sourceNormal):
        from Vector3Math import Vector3

        result = Plane.New()
        result.a = sourceNormal.x
        result.b = sourceNormal.y
        result.c = sourceNormal.z
        result.d = -Vector3.Dot(sourcePoint, sourceNormal)
        return result
Ejemplo n.º 2
0
    def PlaneIntersectLine(self, p1, p2):
        from Vector3Math import Vector3

        normal = Vector3(self.a, self.b, self.c)
        direction = p2 - p1
        dotVal = Vector3.Dot(normal, direction)

        if dotVal == 0.0:
            return -1

        temp = (self.d + Vector3.Dot(normal, p1)) / dot

        result = Vector3.New()
        result.x = p1.x - temp * direction.x
        result.y = p1.y - temp * direction.y
        result.z = p1.z - temp * direction.z

        return result