0001"""
0002**point** determined as the perpendicular foot of a given geomeric
0003object
0004"""
0005
0006__Def__ = ['Foot']
0007
0008__Classes__ = ['PlaneFoot', 'LineFoot']
0009
0010__all__= __Classes__ + __Def__
0011
0012__doc_hints__= {'m_type':'factory'}
0013
0014import pygeo.base.abstracts._real as Real
0015
0016
0017class PlaneFoot(Real._Point):
0018 """
0019*point* on the given **plane** at the intersection with the perpendicular
0020to it through the given **point**
0021
0022 inherits
0023
0024 `_Point`__
0025
0026__ base.abstracts._real._Point.html
0027
0028 """
0029
0030 __doc_hints__= {'factory':'Foot',
0031 'args':['plane, point']}
0032
0033 def __init__(self,plane,point,**kws):
0034 self.plane=plane
0035 self.point=point
0036 Real._Point.__init__(self,*[plane,point],**kws)
0037 self.init()
0038
0039 def findSelf(self):
0040 self.set(self.point)
0041 return self.toPlane(self.plane)
0042
0043
0044class LineFoot(Real._Point):
0045 """
0046*point *on the **line** at the intersection with the perpendicular to it through
0047the given **point**
0048
0049 inherits
0050
0051 `_Point`__
0052
0053__ base.abstracts._real._Point.html
0054
0055 """
0056 __doc_hints__= {'factory':'Foot',
0057 'args':['line, point']}
0058
0059 def __init__(self,line,point,**kws):
0060 self.line=line
0061 self.point=point
0062 Real._Point.__init__(self,*[line,point],**kws)
0063 self.init()
0064
0065 def findSelf(self):
0066 self.set(self.point)
0067 return self.toLine(self.line.p1,self.line.p2)
0068
0069
0070def Foot(*args,**kws):
0071 """
0072'class factory' function returns instance of object derived from the
0073_Point abstract class determined as the perpendicular foot of a given
0074geomeric object
0075 """
0076
0077 from pygeo.base.abstracts._element import method_get
0078 from pygeo.base.support.pygeoexceptions import Argument_Type_Error
0079 from pygeo.base.analytics.pygeomath import vector
0080
0081 __sigs__ = [[Real._Plane,vector],[Real._Line,vector]]
0082
0083 t,i = method_get(__sigs__,args)
0084
0085 if t is None:
0086 raise Argument_Type_Error(__sigs__,args)
0087 else:
0088 if i == 0:
0089 return PlaneFoot(t[0],t[1],**kws)
0090 elif i == 1:
0091 return LineFoot(t[0],t[1],**kws)
0092 else:
0093 raise Argument_Type_Error(__sigs__,args)