Ignore:
Timestamp:
06/10/08 15:48:44 (16 years ago)
Author:
mattausch
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/App/Demos/Vis/CHC_revisited/Vector3.h

    r2751 r2752  
    6767                return (const float*) this;  
    6868        } 
    69  
    7069 
    7170        const float &operator[] (const int inx) const  
     
    8180        } 
    8281 
    83          
    8482        void SetValue(float a)  
    8583        {  
     
    9088        */ 
    9189        int DrivingAxis(void) const; 
    92  
    9390        /** returns the axis, where the std::vector has the smallest value 
    9491        */ 
     
    10097                return (x > y) ? ( (x > z) ? x : z) : ( (y > z) ? y : z); 
    10198        } 
    102          
    10399        /** Returns copy of this vector where all components are positiv. 
    104100        */ 
     
    107103                return Vector3(fabs(x), fabs(y), fabs(z)); 
    108104        } 
    109  
    110         // normalizes the std::vector of unit size corresponding to given std::vector 
     105        /** normalizes the std::vector of unit size corresponding to given std::vector 
     106        */ 
    111107        inline void Normalize(); 
    112  
    113108        /** Returns false if this std::vector has a nan component. 
    114109        */ 
    115110        bool CheckValidity() const; 
    116  
    117         /** 
    118         ===> Using ArbitraryNormal() for constructing coord systems  
    119         ===> is obsoleted by RightHandedBase() method (<JK> 12/20/03).    
    120  
    121         Return an arbitrary normal to `v'. 
    122         In fact it tries v x (0,0,1) an if the result is too small, 
    123         it definitely does v x (0,1,0). It will always work for 
    124         non-degenareted std::vector and is much faster than to use 
    125         TangentVectors. 
    126  
    127         @param v(in) The std::vector we want to find normal for. 
    128         @return The normal std::vector to v. 
    129         */ 
    130         friend inline Vector3 ArbitraryNormal(const Vector3 &v);  
    131  
    132111        /** 
    133112        Find a right handed coordinate system with (*this) being 
     
    152131        */ 
    153132        void RightHandedBase(Vector3& U, Vector3& V) const; 
     133         
     134         
     135        // Unary operators 
     136 
     137        Vector3 operator+ () const; 
     138        Vector3 operator- () const; 
     139 
     140        // Assignment operators 
     141         
     142        Vector3& operator+= (const Vector3 &A); 
     143        Vector3& operator-= (const Vector3 &A); 
     144        Vector3& operator*= (const Vector3 &A); 
     145        Vector3& operator*= (float A); 
     146        Vector3& operator/= (float A); 
     147 
     148 
     149        ////////// 
     150        //-- friends 
     151         
     152        /** 
     153        ===> Using ArbitraryNormal() for constructing coord systems  
     154        ===> is obsoleted by RightHandedBase() method (<JK> 12/20/03).    
     155 
     156        Return an arbitrary normal to `v'. 
     157        In fact it tries v x (0,0,1) an if the result is too small, 
     158        it definitely does v x (0,1,0). It will always work for 
     159        non-degenareted std::vector and is much faster than to use 
     160        TangentVectors. 
     161 
     162        @param v(in) The std::vector we want to find normal for. 
     163        @return The normal std::vector to v. 
     164        */ 
     165        friend inline Vector3 ArbitraryNormal(const Vector3 &v);  
    154166 
    155167        /// Transforms a std::vector to the global coordinate frame. 
     
    162174        */ 
    163175        friend inline Vector3 ToGlobalFrame(const Vector3& loc, 
    164                 const Vector3& U, 
    165                 const Vector3& V, 
    166                 const Vector3& N); 
     176                                                const Vector3& U, 
     177                                                                                const Vector3& V, 
     178                                                                                const Vector3& N); 
    167179 
    168180        /// Transforms a std::vector to a local coordinate frame. 
     
    175187        */ 
    176188        friend inline Vector3 ToLocalFrame(const Vector3& loc, 
    177                 const Vector3& U, 
    178                 const Vector3& V, 
    179                 const Vector3& N); 
     189                                           const Vector3& U, 
     190                                                                           const Vector3& V, 
     191                                                                           const Vector3& N); 
    180192 
    181193        /// the magnitude=size of the std::vector 
     
    187199        /// SqrMagnitude(v1-v2) 
    188200        friend inline float SqrDistance(const Vector3 &v1, const Vector3 &v2); 
    189  
    190         // creates the std::vector of unit size corresponding to given std::vector 
     201        /// creates the std::vector of unit size corresponding to given std::vector 
    191202        friend inline Vector3 Normalize(const Vector3 &A); 
    192  
    193         // Rotate a normal std::vector. 
     203        /// // Rotate a direction vector 
    194204        friend Vector3 PlaneRotate(const Matrix4x4 &, const Vector3 &); 
    195205 
     
    209219        // to the vectors `N','D', and `V'. Then 'N', 'U', and 'V' create 
    210220        // the orthonormal base in space R3. 
    211         friend void TangentVectors(Vector3 &U,  
    212                                        Vector3 &V, // output 
     221        friend void TangentVectors(Vector3 &U, Vector3 &V, // output 
    213222                                                           const Vector3 &normal, // input 
    214223                                                           const Vector3 &dirIncoming); 
    215224 
    216         // Unary operators 
    217         Vector3 operator+ () const; 
    218         Vector3 operator- () const; 
    219  
    220         // Assignment operators 
    221         Vector3& operator+= (const Vector3 &A); 
    222         Vector3& operator-= (const Vector3 &A); 
    223         Vector3& operator*= (const Vector3 &A); 
    224         Vector3& operator*= (float A); 
    225         Vector3& operator/= (float A); 
    226225 
    227226        // Binary operators 
     227         
    228228        friend inline Vector3 operator+ (const Vector3 &A, const Vector3 &B); 
    229229        friend inline Vector3 operator- (const Vector3 &A, const Vector3 &B); 
Note: See TracChangeset for help on using the changeset viewer.