VectorField.h
Go to the documentation of this file.
1 // This file is a part of the OpenSurgSim project.
2 // Copyright 2013, SimQuest Solutions Inc.
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 
16 #ifndef SURGSIM_GRAPHICS_VECTORFIELD_H
17 #define SURGSIM_GRAPHICS_VECTORFIELD_H
18 
21 #include "SurgSim/Math/Vector.h"
22 
23 namespace SurgSim
24 {
25 namespace Graphics
26 {
27 
30 {
35 
38  bool operator==(const VectorFieldData& rhs) const
39  {
40  if (color.hasValue() && rhs.color.hasValue())
41  {
42  return direction == rhs.direction &&
43  color.getValue() == rhs.color.getValue();
44  }
45  else
46  {
47  return direction == rhs.direction;
48  }
49  }
50 
53  bool operator!=(const VectorFieldData& rhs) const
54  {
55  return ! (*this == rhs);
56  }
57 };
58 
60 
61 }; // namespace Graphics
62 }; // namespace SurgSim
63 
64 #endif // SURGSIM_GRAPHICS_VECTORFIELD_H
Definition: CompoundShapeToGraphics.cpp:29
bool operator!=(const VectorFieldData &rhs) const
Compare the vectors and return true if not equal, false if equal.
Definition: VectorField.h:53
A (mathematical) vector is represented as (X,Y,Z) associated with an optional color (R...
Definition: VectorField.h:29
SurgSim::DataStructures::OptionalValue< SurgSim::Math::Vector4d > color
Color (R,G,B,alpha) of the vector (Optional)
Definition: VectorField.h:34
bool operator==(const VectorFieldData &rhs) const
Compare the vectors and return true if equal; Othwise, false.
Definition: VectorField.h:38
Definitions of small fixed-size vector types.
SurgSim::DataStructures::Vertices< VectorFieldData > VectorField
Definition: VectorField.h:59
SurgSim::Math::Vector3d direction
Direction (X,Y,Z) of the vector.
Definition: VectorField.h:32
bool hasValue() const
Query if this object has been assigned a value.
Definition: OptionalValue.h:56
Eigen::Matrix< double, 3, 1 > Vector3d
A 3D vector of doubles.
Definition: Vector.h:57
Base class for mesh structures, handling basic vertex functionality.
Definition: Vertices.h:51
const T & getValue() const
Gets the value.
Definition: OptionalValue.h:78