Changeset 4891 for nanovis/branches/1.1


Ignore:
Timestamp:
Dec 20, 2014, 3:48:23 AM (5 years ago)
Author:
ldelgass
Message:

merge r3872 from trunk

Location:
nanovis/branches/1.1
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • nanovis/branches/1.1

  • nanovis/branches/1.1/vrmath/include/vrmath/Vector2f.h

    r4890 r4891  
    4040    void set(const Vector2f& v);
    4141
    42     float dot() const;
     42    double dot() const;
    4343
    4444    double length() const;
     
    6767}
    6868
    69 inline float Vector2f::dot() const
     69inline double Vector2f::dot() const
    7070{
    7171    return (x * x + y * y);
  • nanovis/branches/1.1/vrmath/include/vrmath/Vector3f.h

    r4890 r4891  
    5858    Vector3f scale(const Vector3f& scale) const;
    5959
    60     Vector3f scale(float scale) const;
     60    Vector3f scale(double scale) const;
    6161
    6262    bool operator==(const Vector3f& v) const;
     
    6767
    6868    // scalar ops
    69     Vector3f operator+(float scalar) const;
    70     Vector3f operator-(float scalar) const;
    71     Vector3f operator*(float scalar) const;
    72     Vector3f operator/(float scalar) const;
    73     Vector3f& operator*=(float scalar);
     69    Vector3f operator+(double scalar) const;
     70    Vector3f operator-(double scalar) const;
     71    Vector3f operator*(double scalar) const;
     72    Vector3f operator/(double scalar) const;
     73    Vector3f& operator*=(double scalar);
    7474
    7575    // vector ops
     
    113113}
    114114
    115 inline Vector3f Vector3f::operator+(float scalar) const
     115inline Vector3f Vector3f::operator+(double scalar) const
    116116{
    117117    return Vector3f(x + scalar, y + scalar, z + scalar);
    118118}
    119119
    120 inline Vector3f Vector3f::operator-(float scalar) const
     120inline Vector3f Vector3f::operator-(double scalar) const
    121121{
    122122    return Vector3f(x - scalar, y - scalar, z - scalar);
    123123}
    124124
    125 inline Vector3f Vector3f::operator*(float scalar) const
     125inline Vector3f Vector3f::operator*(double scalar) const
    126126{
    127127    return Vector3f(x * scalar, y * scalar, z * scalar);
    128128}
    129129
    130 inline Vector3f Vector3f::operator/(float scalar) const
     130inline Vector3f Vector3f::operator/(double scalar) const
    131131{
    132132    return Vector3f(x / scalar, y / scalar, z / scalar);
    133133}
    134134
    135 inline Vector3f& Vector3f::operator*=(float scalar)
     135inline Vector3f& Vector3f::operator*=(double scalar)
    136136{
    137137    x *= scalar;
     
    168168
    169169#if 0
    170 inline Vector3f operator*(float scale, const Vector3f& value)
     170inline Vector3f operator*(double scale, const Vector3f& value)
    171171{
    172172    return Vector3f(value.x * scale, value.y * scale, value.z * scale);
     
    231231inline Vector3f Vector3f::normalize() const
    232232{
    233     float len = length();
    234     if (len > 1.0e-6) {
     233    double len = length();
     234    if (len > 0.0) {
    235235        return Vector3f(x / len, y / len, z / len);
    236236    } else {
     
    239239}
    240240
    241 inline Vector3f Vector3f::scale(float scale) const
     241inline Vector3f Vector3f::scale(double scale) const
    242242{
    243243    return Vector3f(x * scale, y * scale, z * scale);
  • nanovis/branches/1.1/vrmath/include/vrmath/Vector4f.h

    r4890 r4891  
    6666    }
    6767
    68     Vector4f operator*(float op2) const
     68    Vector4f operator*(double op2) const
    6969    {
    7070        return Vector4f(x * op2, y * op2, z * op2, w * op2);
    7171    }
    7272
    73     Vector4f operator/(float op2) const
     73    Vector4f operator/(double op2) const
    7474    {
    7575        return Vector4f(x / op2, y / op2, z / op2, w / op2);
     
    7878    void divideByW();
    7979
    80     float dot(const Vector4f& vec) const;
     80    double dot(const Vector4f& vec) const;
    8181
    8282    union {
     
    122122}
    123123
    124 inline float Vector4f::dot(const Vector4f& v) const
     124inline double Vector4f::dot(const Vector4f& v) const
    125125{
    126     return (x * v.x + y * v.y + z * v.z + w * v.w);
     126    return ((double)x * v.x + (double)y * v.y + (double)z * v.z + (double)w * v.w);
    127127}
    128128
Note: See TracChangeset for help on using the changeset viewer.