SmtC: Show me the Code
Ole Peter Smith
Instituto de Matemática e Estatística
Universidade Federal de Goiás
http://www.olesmith.com.br

Vectors
O bem que a violência faz, é - sempre - passageiro.
O mal que ela faz, é permanente.
Mahatma Gandhi
< Multiply | Utilities | Notables >
Python Listing: Vector.5.py.
    def DotProduct(v,w):
        return v*w
    
    def SqLength(v):
        return v*v
    
    def Length(v):
        return sqrt( v.SqLength() )
    
    def Normalize(v,length=1.0):
        w=Vector()
        if (v.Length()>0.0):
            w=v*(1.0/v.Length())
    
    def Hat2(v):
        return Vector([ -v[1],v[0] ])

    def Projection(v,e):
        return e*(v*e)/e.SqLength()
    
    def Complement(v,e):
        return v-v.Projection(e)
< Multiply | Utilities | Notables >
Messages:
0 secs.