Example #1
0
 def _reducedVerticesCrossProduct(self):
     a, b, c = self.reducedVertices
     return cross(b, c), cross(c, a), cross(a, b)
Example #2
0
            to perform the operation safely you should provide 
            space dimension (as "size" parameter for 
            either point or line point or line direction).
            Assuming space dimension is 2 
            (elseware lots of perpendicular lines wrt the point and the line exist)
            '''
            pWarn(s)
        else:
            raise SpaceFuncsException('for space dimension > 2 you should have point outside of the line')
        return Line(point, direction=ooarray(line.direction[1], -line.direction[0]))
    else:
        return Line(point, projection)

# TODO: add unknown spaceDimension warning
_perpendicularToPlane=lambda point, plane:\
    Line(point, direction=cross(*plane.directions)) \
    if point.size is 3 or plane.basePoint.size is 3 or plane.directions[1].size is 3 or plane.directions[1].size is 3\
    else Line(point, point.projection(plane))
    
#TODO: intersection of plane & line


def _contains(obj, p, tol, inside = False):
    assert isinstance(p, Point), 'implemented only for Point yet'
    if isinstance(obj, (Line, Plane)):
        P = p.projection(obj)
        if isinstance(P, ndarray) and str(p.dtype) != 'object':
            return norm(p - P) <= tol
        else:
            return (p == P)(tol=tol)
    elif isinstance(obj, (Ring, Orb)):
Example #3
0
            (elseware lots of perpendicular lines wrt the point and the line exist)
            '''
            pWarn(s)
        else:
            raise SpaceFuncsException(
                'for space dimension > 2 you should have point outside of the line'
            )
        return Line(point,
                    direction=ooarray(line.direction[1], -line.direction[0]))
    else:
        return Line(point, projection)


# TODO: add unknown spaceDimension warning
_perpendicularToPlane=lambda point, plane:\
    Line(point, direction=cross(*plane.directions)) \
    if point.size is 3 or plane.basePoint.size is 3 or plane.directions[1].size is 3 or plane.directions[1].size is 3\
    else Line(point, point.projection(plane))

#TODO: intersection of plane & line


def _contains(obj, p, tol, inside=False):
    assert isinstance(p, Point), 'implemented only for Point yet'
    if isinstance(obj, (Line, Plane)):
        P = p.projection(obj)
        if isinstance(P, ndarray) and str(p.dtype) != 'object':
            return norm(p - P) <= tol
        else:
            return (p == P)(tol=tol)
    elif isinstance(obj, (Ring, Orb)):