Changeset 4890 for nanovis/branches
- Timestamp:
- Dec 19, 2014, 11:37:04 PM (10 years ago)
- Location:
- nanovis/branches/1.1
- Files:
-
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
nanovis/branches/1.1
- Property svn:mergeinfo changed
/trunk/packages/vizservers/nanovis merged: 3627-3628
- Property svn:mergeinfo changed
-
nanovis/branches/1.1/FlowParticles.cpp
r4889 r4890 12 12 #include <assert.h> 13 13 14 #include <vrmath/ Vector4f.h>14 #include <vrmath/Color4f.h> 15 15 16 16 #include "nanovis.h" // For NMESH … … 61 61 { 62 62 _renderer->setPos(Flow::getRelativePosition(&_sv.position)); 63 _renderer->setColor( Vector4f(_sv.color.r,64 65 66 63 _renderer->setColor(Color4f(_sv.color.r, 64 _sv.color.g, 65 _sv.color.b, 66 _sv.color.a)); 67 67 _renderer->particleSize(_sv.particleSize); 68 68 _renderer->setAxis(_sv.position.axis); -
nanovis/branches/1.1/Grid.cpp
r4889 r4890 9 9 #include <GL/glew.h> 10 10 #include <GL/gl.h> 11 12 #include <util/Fonts.h> 13 #include <vrmath/Color4f.h> 11 14 12 15 #include "Grid.h" … … 86 89 87 90 glLineWidth(2.0f); 88 glColor4f(_axisColor.r ed, _axisColor.green, _axisColor.blue,89 _axisColor.a lpha);91 glColor4f(_axisColor.r, _axisColor.g, _axisColor.b, 92 _axisColor.a); 90 93 91 94 glBegin(GL_LINES); … … 101 104 102 105 glLineWidth(1.0f); 103 glColor4f(_majorColor.r ed, _majorColor.green, _majorColor.blue,104 _majorColor.a lpha);106 glColor4f(_majorColor.r, _majorColor.g, _majorColor.b, 107 _majorColor.a); 105 108 106 109 glBegin(GL_LINES); … … 137 140 138 141 // Set minor line color 139 glColor4f(_minorColor.r ed, _minorColor.green, _minorColor.blue,140 _minorColor.a lpha);142 glColor4f(_minorColor.r, _minorColor.g, _minorColor.b, 143 _minorColor.a); 141 144 142 145 glBegin(GL_LINES); -
nanovis/branches/1.1/Grid.h
r4889 r4890 7 7 #define NV_GRID_H 8 8 9 #include < util/Fonts.h>9 #include <vrmath/Color4f.h> 10 10 11 11 #include "Axis.h" … … 14 14 namespace nv { 15 15 16 class RGBA 17 { 18 public: 19 RGBA(float r, float g, float b, float a) : 20 red(r), 21 green(g), 22 blue(b), 23 alpha(a) 24 {} 25 26 void set(float r, float g, float b, float a) 27 { 28 red = r; 29 green = g; 30 blue = b; 31 alpha = a; 32 } 33 34 float red, green, blue, alpha; 35 }; 16 namespace util { 17 class Fonts; 18 } 36 19 37 20 class Grid … … 71 54 72 55 private: 73 RGBA_axisColor, _majorColor, _minorColor;56 vrmath::Color4f _axisColor, _majorColor, _minorColor; 74 57 nv::util::Fonts *_font; 75 58 bool _visible; -
nanovis/branches/1.1/Makefile.in
r4889 r4890 283 283 FlowParticles.o: FlowParticles.cpp FlowParticles.h FlowTypes.h FlowCmd.h Switch.h Trace.h ParticleRenderer.h Volume.h $(VRMATH_DIR)/include/vrmath/Vector3f.h $(VRMATH_DIR)/include/vrmath/Vector4f.h 284 284 GradientFilter.o: GradientFilter.cpp GradientFilter.h 285 Grid.o: Grid.cpp Grid.h Axis.h Chain.h 285 Grid.o: Grid.cpp Grid.h Axis.h Chain.h $(UTIL_DIR)/Fonts.h $(VRMATH_DIR)/include/vrmath/Color4f.h $(VRMATH_DIR)/include/vrmath/Vector4f.h 286 286 HeightMap.o: HeightMap.cpp HeightMap.h 287 287 LIC.o: LIC.cpp LIC.h define.h … … 322 322 dxReader.o: dxReader.cpp ReaderCommon.h config.h nanovis.h Unirect.h ZincBlendeVolume.h ZincBlendeReconstructor.h 323 323 md5.o: md5.h 324 nanovis.o: nanovis.cpp nanovis.h nanovisServer.h config.h define.h Command.h Flow.h Grid.h HeightMap.h Camera.h LIC.h ZincBlendeReconstructor.h PerfQuery.h PlaneRenderer.h PointSetRenderer.h PointSet.h Switch.h Trace.h Unirect.h VelocityArrowsSlice.h VolumeInterpolator.h VolumeRenderer.h ZincBlendeVolume.h Axis.h Chain.h 324 nanovis.o: nanovis.cpp nanovis.h nanovisServer.h config.h define.h Command.h Flow.h Grid.h HeightMap.h Camera.h LIC.h ZincBlendeReconstructor.h PerfQuery.h PlaneRenderer.h PointSetRenderer.h PointSet.h Switch.h Trace.h Unirect.h VelocityArrowsSlice.h VolumeInterpolator.h VolumeRenderer.h ZincBlendeVolume.h Axis.h Chain.h $(UTIL_DIR)/Fonts.h 325 325 nanovisServer.o: nanovisServer.cpp nanovisServer.h config.h nanovis.h define.h Command.h ReadBuffer.h Shader.h Trace.h -
nanovis/branches/1.1/PCASplit.h
r4889 r4890 10 10 11 11 #include <vrmath/Vector3f.h> 12 #include <vrmath/ Vector4f.h>12 #include <vrmath/Color4f.h> 13 13 14 14 namespace PCA { … … 23 23 24 24 vrmath::Vector3f position; 25 vrmath:: Vector4f color;25 vrmath::Color4f color; 26 26 float size; 27 27 float value; … … 57 57 58 58 vrmath::Vector3f centroid; 59 vrmath:: Vector4f color;59 vrmath::Color4f color; 60 60 float scale; 61 61 -
nanovis/branches/1.1/ParticleRenderer.cpp
r4889 r4890 12 12 13 13 #include <GL/glew.h> 14 15 #include <vrmath/Color4f.h> 14 16 15 17 #include "ParticleRenderer.h" -
nanovis/branches/1.1/ParticleRenderer.h
r4889 r4890 12 12 13 13 #include <vrmath/Vector3f.h> 14 #include <vrmath/ Vector4f.h>14 #include <vrmath/Color4f.h> 15 15 16 16 #include "ParticleAdvectionShader.h" … … 63 63 } 64 64 65 void setColor(const vrmath:: Vector4f& color)65 void setColor(const vrmath::Color4f& color) 66 66 { 67 67 _color = color; … … 122 122 int _sliceAxis; 123 123 124 vrmath:: Vector4f _color;124 vrmath::Color4f _color; 125 125 126 126 //the storage of particles is implemented as a 2D array. -
nanovis/branches/1.1/PointSet.cpp
r4889 r4890 9 9 #include <vrmath/Vector3f.h> 10 10 #include <vrmath/Vector4f.h> 11 #include <vrmath/Color4f.h> 11 12 12 13 #include "PointSet.h" … … 58 59 59 60 PCA::Point *points; 60 vrmath:: Vector4f *colors = (vrmath::Vector4f *)color;61 vrmath::Color4f *colors = (vrmath::Color4f *)color; 61 62 int numOfPoints; 62 63 int index; -
nanovis/branches/1.1/PointSetRenderer.cpp
r4889 r4890 64 64 Point *p = points; 65 65 for (int i = 0; i < length; ++i, ++p) { 66 glColor4f(p->color. x, p->color.y, p->color.z, p->color.w);66 glColor4f(p->color.r, p->color.g, p->color.b, p->color.a); 67 67 glVertex3f(p->position.x, p->position.y, p->position.z); 68 68 } -
nanovis/branches/1.1/vrmath/BBox.cpp
r3494 r4890 20 20 } 21 21 22 BBox::BBox(const BBox& bbox) 22 BBox::BBox(const BBox& other) : 23 min(other.min), 24 max(other.max) 23 25 { 24 min = bbox.min;25 max = bbox.max;26 26 } 27 27 28 BBox::BBox(const Vector3f& minv, const Vector3f& maxv) 28 BBox::BBox(const Vector3f& minv, const Vector3f& maxv) : 29 min(minv), 30 max(maxv) 29 31 { 30 min = minv;31 max = maxv;32 32 } 33 33 … … 40 40 bool BBox::isEmpty() 41 41 { 42 if ((min.x > max.x) || (min.y > max.y) || (min.z > max.z)) { 43 return true; 44 } 42 return (isEmptyX() && isEmptyY() && isEmptyZ()); 43 } 45 44 46 return false; 45 bool BBox::isEmptyX() 46 { 47 return (min.x > max.x); 48 } 49 50 bool BBox::isEmptyY() 51 { 52 return (min.y > max.y); 53 } 54 55 bool BBox::isEmptyZ() 56 { 57 return (min.z > max.z); 47 58 } 48 59 … … 95 106 void BBox::transform(const BBox& box, const Matrix4x4d& mat) 96 107 { 97 float halfSizeX = (box.max.x - box.min.x) * 0.5f; 98 float halfSizeY = (box.max.y - box.min.y) * 0.5f; 99 float halfSizeZ = (box.max.z - box.min.z) * 0.5f; 100 101 float centerX = (box.max.x + box.min.x) * 0.5f; 102 float centerY = (box.max.y + box.min.y) * 0.5f; 103 float centerZ = (box.max.z + box.min.z) * 0.5f; 108 float x0 = box.min.x; 109 float y0 = box.min.y; 110 float z0 = box.min.z; 111 float x1 = box.max.x; 112 float y1 = box.max.y; 113 float z1 = box.max.z; 104 114 105 115 Vector4f points[8]; 106 116 107 points[0].set( centerX + halfSizeX, centerY + halfSizeY, centerZ + halfSizeZ, 1);108 points[1].set( centerX + halfSizeX, centerY + halfSizeY, centerZ - halfSizeZ, 1);109 points[2].set( centerX - halfSizeX, centerY + halfSizeY, centerZ - halfSizeZ, 1);110 points[3].set( centerX - halfSizeX, centerY + halfSizeY, centerZ + halfSizeZ, 1);111 points[4].set( centerX - halfSizeX, centerY - halfSizeY, centerZ + halfSizeZ, 1);112 points[5].set( centerX - halfSizeX, centerY - halfSizeY, centerZ - halfSizeZ, 1);113 points[6].set( centerX + halfSizeX, centerY - halfSizeY, centerZ - halfSizeZ, 1);114 points[7].set( centerX + halfSizeX, centerY - halfSizeY, centerZ + halfSizeZ, 1);117 points[0].set(x0, y0, z0, 1); 118 points[1].set(x1, y0, z0, 1); 119 points[2].set(x0, y1, z0, 1); 120 points[3].set(x0, y0, z1, 1); 121 points[4].set(x1, y1, z0, 1); 122 points[5].set(x1, y0, z1, 1); 123 points[6].set(x0, y1, z1, 1); 124 points[7].set(x1, y1, z1, 1); 115 125 116 float minX , minY, minZ;117 float maxX , maxY, maxZ;126 float minX = FLT_MAX, minY = FLT_MAX, minZ = FLT_MAX; 127 float maxX = -FLT_MAX, maxY = -FLT_MAX, maxZ = -FLT_MAX; 118 128 119 points[0] = mat.transform(points[0]); 120 121 minX = maxX = points[0].x; 122 minY = maxY = points[0].y; 123 minZ = maxZ = points[0].z; 124 125 for (int i = 1; i < 8; i++) { 129 for (int i = 0; i < 8; i++) { 126 130 points[i] = mat.transform(points[i]); 127 131 128 132 if (points[i].x > maxX) maxX = points[i].x; 129 else if (points[i].x < minX) minX = points[i].x; 130 133 if (points[i].x < minX) minX = points[i].x; 131 134 if (points[i].y > maxY) maxY = points[i].y; 132 else if (points[i].y < minY) minY = points[i].y; 133 135 if (points[i].y < minY) minY = points[i].y; 134 136 if (points[i].z > maxZ) maxZ = points[i].z; 135 elseif (points[i].z < minZ) minZ = points[i].z;137 if (points[i].z < minZ) minZ = points[i].z; 136 138 } 137 139 … … 149 151 } 150 152 151 bool BBox:: intersect(const Vector3f& point)153 bool BBox::contains(const Vector3f& point) 152 154 { 153 155 if ((point.x < min.x) || (point.x > max.x)) return false; -
nanovis/branches/1.1/vrmath/Makefile.in
r3567 r4890 40 40 VRMATHLIB = vrmath.a 41 41 42 # BBox.o \43 42 # BPlane.o \ 44 43 # Projection.o \ 45 44 46 45 OBJS = \ 46 BBox.o \ 47 47 LineSegment.o \ 48 48 Matrix4x4f.o \ -
nanovis/branches/1.1/vrmath/Matrix4x4d.cpp
r3492 r4890 946 946 } 947 947 948 void Matrix4x4d::setFloat( float *m)948 void Matrix4x4d::setFloat(const float *m) 949 949 { 950 950 for (int i = 0; i < 16; ++i) { -
nanovis/branches/1.1/vrmath/Matrix4x4f.cpp
r3492 r4890 871 871 } 872 872 873 void Matrix4x4f::setDouble( double *m)873 void Matrix4x4f::setDouble(const double *m) 874 874 { 875 875 for (int i = 0; i < 16; ++i) { -
nanovis/branches/1.1/vrmath/include/vrmath/BBox.h
r3494 r4890 35 35 BBox(const Vector3f& min, const Vector3f& max); 36 36 37 BBox& operator=(const BBox& other) 38 { 39 if (&other != this) { 40 min = other.min; 41 max = other.max; 42 } 43 return *this; 44 } 45 37 46 /** 38 47 * @brief make an empty bounding box … … 51 60 */ 52 61 bool isEmpty(); 62 bool isEmptyX(); 63 bool isEmptyY(); 64 bool isEmptyZ(); 53 65 54 66 /** … … 63 75 64 76 /** 65 * @brief transform a bounding box with a nmatrix and set the bounding box77 * @brief transform a bounding box with a matrix and set the bounding box 66 78 */ 67 79 void transform(const BBox& box, const Matrix4x4d& mat); … … 73 85 74 86 /** 75 * @brief check if the bounding box intersect witha point87 * @brief check if the bounding box contains a point 76 88 */ 77 bool intersect(const Vector3f& point);89 bool contains(const Vector3f& point); 78 90 79 91 float getRadius() const; … … 93 105 { 94 106 Vector3f temp; 95 temp.x = (max.x + min.x) * 0.5f;107 temp.x = (max.x + min.x) * 0.5f; 96 108 temp.y = (max.y + min.y) * 0.5f; 97 109 temp.z = (max.z + min.z) * 0.5f; -
nanovis/branches/1.1/vrmath/include/vrmath/Matrix4x4d.h
r3492 r4890 30 30 { 31 31 set(m); 32 } 33 34 Matrix4x4d(const Matrix4x4d& other) 35 { 36 set(other.get()); 37 } 38 39 Matrix4x4d& operator=(const Matrix4x4d& other) 40 { 41 if (&other != this) { 42 set(other.get()); 43 } 44 return *this; 32 45 } 33 46 … … 113 126 * @param m float matrix values 114 127 */ 115 void set( double *m);128 void set(const double *m); 116 129 117 void setFloat( float *m);130 void setFloat(const float *m); 118 131 119 132 void print() const; … … 136 149 } 137 150 138 inline void Matrix4x4d::set( double *m)151 inline void Matrix4x4d::set(const double *m) 139 152 { 140 153 memcpy(_data, m, sizeof(double) * 16); -
nanovis/branches/1.1/vrmath/include/vrmath/Matrix4x4f.h
r3492 r4890 30 30 { 31 31 set(m); 32 } 33 34 Matrix4x4f(const Matrix4x4f& other) 35 { 36 set(other.get()); 37 } 38 39 Matrix4x4f& operator=(const Matrix4x4f& other) 40 { 41 if (&other != this) { 42 set(other.get()); 43 } 44 return *this; 32 45 } 33 46 … … 113 126 * @param m float matrix values 114 127 */ 115 void set( float *m);128 void set(const float *m); 116 129 117 130 /** … … 119 132 * @param m float matrix values 120 133 */ 121 void setDouble( double *m);134 void setDouble(const double *m); 122 135 123 136 void print() const; … … 140 153 } 141 154 142 inline void Matrix4x4f::set( float *m)155 inline void Matrix4x4f::set(const float *m) 143 156 { 144 157 memcpy(_data, m, sizeof(float) * 16); -
nanovis/branches/1.1/vrmath/include/vrmath/Quaternion.h
r3492 r4890 21 21 Quaternion(double x, double y, double z, double w); 22 22 23 void set(double x1, double y1, double z1, double w1); 23 Quaternion(const Quaternion& other) : 24 x(other.x), y(other.y), z(other.z), w(other.w) 25 {} 26 27 Quaternion& operator=(const Quaternion& other) 28 { 29 if (&other != this) { 30 set(other.x, other.y, other.z, other.w); 31 } 32 return *this; 33 } 34 35 void set(double x, double y, double z, double w); 24 36 25 37 const Quaternion& set(const Rotation& rot); … … 77 89 } 78 90 79 inline void Quaternion::set(double x 1, double y1, double z1, double w1)91 inline void Quaternion::set(double x, double y, double z, double w) 80 92 { 81 x = x1;82 y = y1;83 z = z1;84 w = w1;93 this->x = x; 94 this->y = y; 95 this->z = z; 96 this->w = w; 85 97 } 86 98 -
nanovis/branches/1.1/vrmath/include/vrmath/Rotation.h
r3492 r4890 28 28 {} 29 29 30 Rotation(const Rotation& rotation) :31 x( rotation.x), y(rotation.y), z(rotation.z), angle(rotation.angle)30 Rotation(const Rotation& other) : 31 x(other.x), y(other.y), z(other.z), angle(other.angle) 32 32 {} 33 34 Rotation& operator=(const Rotation& other) 35 { 36 if (&other != this) { 37 set(other.x, other.y, other.z, other.angle); 38 } 39 return *this; 40 } 33 41 34 42 double getX() const -
nanovis/branches/1.1/vrmath/include/vrmath/Vector2f.h
r3492 r4890 28 28 {} 29 29 30 void set(float x1, float y1); 30 Vector2f& operator=(const Vector2f& other) 31 { 32 if (&other != this) { 33 set(other.x, other.y); 34 } 35 return *this; 36 } 37 38 void set(float x, float y); 31 39 32 40 void set(const Vector2f& v); … … 38 46 double distance(const Vector2f& v) const; 39 47 40 double distance(float x 1, float y1) const;48 double distance(float x, float y) const; 41 49 42 50 double distanceSquare(const Vector2f& v) const; 43 51 44 double distanceSquare(float x 1, float y1) const;52 double distanceSquare(float x, float y) const; 45 53 46 54 float x, y; 47 55 }; 48 56 49 inline void Vector2f::set(float x 1, float y1)57 inline void Vector2f::set(float x, float y) 50 58 { 51 x = x1;52 y = y1;59 this->x = x; 60 this->y = y; 53 61 } 54 62 … … 75 83 } 76 84 77 inline double Vector2f::distance(float x 1, float y1) const85 inline double Vector2f::distance(float x, float y) const 78 86 { 79 double x 2 = ((double)x1 - (double)x) , y2 = ((double)y1 - (double)y);80 return sqrt(x 2 * x2 + y2 * y2);87 double x1 = ((double)x - (double)this->x) , y1 = ((double)y - (double)this->y); 88 return sqrt(x1 * x1 + y1 * y1); 81 89 } 82 90 … … 87 95 } 88 96 89 inline double Vector2f::distanceSquare(float x 1, float y1) const97 inline double Vector2f::distanceSquare(float x, float y) const 90 98 { 91 double x 2 = ((double)x1 - (double)x) , y2 = ((double)y1 - (double)y);92 return (x 2 * x2 + y2 * y2);99 double x1 = ((double)x - (double)this->x) , y1 = ((double)y - (double)this->y); 100 return (x1 * x1 + y1 * y1); 93 101 } 94 102 -
nanovis/branches/1.1/vrmath/include/vrmath/Vector3f.h
r4889 r4890 27 27 x(x1), y(y1), z(z1) 28 28 {} 29 30 void set(float x1, float y1, float z1); 31 32 void set(const Vector3f& v3); 29 30 Vector3f& operator=(const Vector3f& other) 31 { 32 if (&other != this) { 33 set(other.x, other.y, other.z); 34 } 35 return *this; 36 } 37 38 void set(float x, float y, float z); 39 40 void set(const Vector3f& v); 33 41 34 42 double length() const; 35 43 36 double distance(const Vector3f& v 3) const;37 38 double distance(float x 1, float y1, float z1) const;39 40 double distanceSquare(const Vector3f& v 3) const;41 42 double distanceSquare(float x 1, float y1, float z1) const;44 double distance(const Vector3f& v) const; 45 46 double distance(float x, float y, float z) const; 47 48 double distanceSquare(const Vector3f& v) const; 49 50 double distanceSquare(float x, float y, float z) const; 43 51 44 52 double dot(const Vector3f& v) const; 45 53 46 Vector3f cross(const Vector3f& v 1) const;54 Vector3f cross(const Vector3f& v) const; 47 55 48 56 Vector3f normalize() const; 49 57 50 Vector3f scale(const Vector3f& sc ) const;58 Vector3f scale(const Vector3f& scale) const; 51 59 52 60 Vector3f scale(float scale) const; … … 166 174 #endif 167 175 168 inline void Vector3f::set(float x 1, float y1, float z1)169 { 170 x = x1;171 y = y1;172 z = z1;173 } 174 175 inline void Vector3f::set(const Vector3f& v 3)176 { 177 x = v 3.x;178 y = v 3.y;179 z = v 3.z;176 inline void Vector3f::set(float x, float y, float z) 177 { 178 this->x = x; 179 this->y = y; 180 this->z = z; 181 } 182 183 inline void Vector3f::set(const Vector3f& v) 184 { 185 x = v.x; 186 y = v.y; 187 z = v.z; 180 188 } 181 189 … … 190 198 } 191 199 192 inline double Vector3f::distance(const Vector3f& v 3) const193 { 194 double x1 = ((double)v 3.x - (double)x) , y1 = ((double)v3.y - (double)y), z1 = ((double)v3.z - (double)z);200 inline double Vector3f::distance(const Vector3f& v) const 201 { 202 double x1 = ((double)v.x - (double)x) , y1 = ((double)v.y - (double)y), z1 = ((double)v.z - (double)z); 195 203 return sqrt(x1 * x1 + y1 * y1 + z1 * z1); 196 204 } 197 205 198 inline double Vector3f::distance(float x 1, float y1, float z1) const206 inline double Vector3f::distance(float x, float y, float z) const 199 207 { 200 double x 2 = ((double)x1 - (double)x) , y2 = ((double)y1 - (double)y), z2 = ((double)z1 - (double)z);201 return sqrt(x 2 * x2 + y2 * y2 + z2 * z2);202 } 203 204 inline double Vector3f::distanceSquare(const Vector3f& v 3) const208 double x1 = ((double)x - (double)this->x) , y1 = ((double)y - (double)this->y), z1 = ((double)z - (double)this->z); 209 return sqrt(x1 * x1 + y1 * y1 + z1 * z1); 210 } 211 212 inline double Vector3f::distanceSquare(const Vector3f& v) const 205 213 { 206 double x1 = ((double)v 3.x - (double)x) , y1 = ((double)v3.y - (double)y), z1 = ((double)v3.z - (double)z);214 double x1 = ((double)v.x - (double)x) , y1 = ((double)v.y - (double)y), z1 = ((double)v.z - (double)z); 207 215 return (x1 * x1 + y1 * y1 + z1 * z1); 208 216 } 209 217 210 inline double Vector3f::distanceSquare(float x 1, float y1, float z1) const218 inline double Vector3f::distanceSquare(float x, float y, float z) const 211 219 { 212 double x 2 = ((double)x1 - (double)x) , y2 = ((double)y1 - (double)y), z2 = ((double)z1 - (double)z);213 return (x 2 * x2 + y2 * y2 + z2 * z2);220 double x1 = ((double)x - (double)this->x) , y1 = ((double)y - (double)this->y), z1 = ((double)z - (double)this->z); 221 return (x1 * x1 + y1 * y1 + z1 * z1); 214 222 } 215 223 … … 236 244 } 237 245 238 inline Vector3f Vector3f::scale(const Vector3f& sc ) const239 { 240 return Vector3f(x * sc .x, y * sc.y, z * sc.z);246 inline Vector3f Vector3f::scale(const Vector3f& scale) const 247 { 248 return Vector3f(x * scale.x, y * scale.y, z * scale.z); 241 249 } 242 250 -
nanovis/branches/1.1/vrmath/include/vrmath/Vector4f.h
r3567 r4890 24 24 {} 25 25 26 Vector4f(const Vector3f& v 3, float w1) :27 x(v 3.x), y(v3.y), z(v3.z), w(w1)26 Vector4f(const Vector3f& v, float w1) : 27 x(v.x), y(v.y), z(v.z), w(w1) 28 28 {} 29 29 … … 32 32 {} 33 33 34 void set(float x 1, float y1, float z1, float w1);34 void set(float x, float y, float z, float w); 35 35 36 36 void set(const Vector3f& v, float w); 37 37 38 void set(const Vector4f& v4); 38 void set(const Vector4f& v); 39 40 Vector4f& operator=(const Vector4f& other) 41 { 42 if (&other != this) { 43 set(other.x, other.y, other.z, other.w); 44 } 45 return *this; 46 } 39 47 40 48 bool operator==(const Vector4f& op2) const … … 90 98 } 91 99 92 inline void Vector4f::set(float x 1, float y1, float z1, float w1)100 inline void Vector4f::set(float x, float y, float z, float w) 93 101 { 94 x = x1;95 y = y1;96 z = z1;97 w = w1;102 this->x = x; 103 this->y = y; 104 this->z = z; 105 this->w = w; 98 106 } 99 107 100 inline void Vector4f::set(const Vector4f& v4) 101 { 102 x = v4.x; 103 y = v4.y; 104 z = v4.z; 105 w = v4.w; 106 } 107 108 inline void Vector4f::set(const Vector3f& v, float w1) 108 inline void Vector4f::set(const Vector4f& v) 109 109 { 110 110 x = v.x; 111 111 y = v.y; 112 112 z = v.z; 113 w = w1;113 w = v.w; 114 114 } 115 115 116 inline float Vector4f::dot(const Vector4f& vec) const116 inline void Vector4f::set(const Vector3f& v, float w) 117 117 { 118 return (x * vec.x + y * vec.y + z * vec.z + w * vec.w); 118 x = v.x; 119 y = v.y; 120 z = v.z; 121 this->w = w; 122 } 123 124 inline float Vector4f::dot(const Vector4f& v) const 125 { 126 return (x * v.x + y * v.y + z * v.z + w * v.w); 119 127 } 120 128
Note: See TracChangeset
for help on using the changeset viewer.