VectorField.h
Go to the documentation of this file.
// This file is a part of the OpenSurgSim project.
// Copyright 2013, SimQuest Solutions Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef SURGSIM_GRAPHICS_VECTORFIELD_H
#define SURGSIM_GRAPHICS_VECTORFIELD_H
#include "SurgSim/DataStructures/OptionalValue.h"
#include "SurgSim/DataStructures/Vertices.h"
#include "SurgSim/Math/Vector.h"
namespace SurgSim
{
namespace Graphics
{
struct VectorFieldData
{
SurgSim::Math::Vector3d direction;
SurgSim::DataStructures::OptionalValue<SurgSim::Math::Vector4d> color;
bool operator==(const VectorFieldData& rhs) const
{
if (color.hasValue() && rhs.color.hasValue())
{
return direction == rhs.direction &&
color.getValue() == rhs.color.getValue();
}
else
{
return direction == rhs.direction;
}
}
bool operator!=(const VectorFieldData& rhs) const
{
return ! (*this == rhs);
}
};
typedef SurgSim::DataStructures::Vertices<VectorFieldData> VectorField;
}; // namespace Graphics
}; // namespace SurgSim
#endif // SURGSIM_GRAPHICS_VECTORFIELD_H
SurgSim
Definition: CompoundShapeToGraphics.cpp:29
Vertices.h
SurgSim::Graphics::VectorFieldData::operator!=
bool operator!=(const VectorFieldData &rhs) const
Compare the vectors and return true if not equal, false if equal.
Definition: VectorField.h:53
SurgSim::DataStructures::OptionalValue< SurgSim::Math::Vector4d >
SurgSim::Graphics::VectorFieldData
A (mathematical) vector is represented as (X,Y,Z) associated with an optional color (R...
Definition: VectorField.h:29
SurgSim::Graphics::VectorFieldData::color
SurgSim::DataStructures::OptionalValue< SurgSim::Math::Vector4d > color
Color (R,G,B,alpha) of the vector (Optional)
Definition: VectorField.h:34
SurgSim::Graphics::VectorFieldData::operator==
bool operator==(const VectorFieldData &rhs) const
Compare the vectors and return true if equal; Othwise, false.
Definition: VectorField.h:38
Vector.h
Definitions of small fixed-size vector types.
SurgSim::Graphics::VectorField
SurgSim::DataStructures::Vertices< VectorFieldData > VectorField
Definition: VectorField.h:59
SurgSim::Graphics::VectorFieldData::direction
SurgSim::Math::Vector3d direction
Direction (X,Y,Z) of the vector.
Definition: VectorField.h:32
OptionalValue.h
SurgSim::DataStructures::OptionalValue::hasValue
bool hasValue() const
Query if this object has been assigned a value.
Definition: OptionalValue.h:56
SurgSim::Math::Vector3d
Eigen::Matrix< double, 3, 1 > Vector3d
A 3D vector of doubles.
Definition: Vector.h:57
SurgSim::DataStructures::Vertices
Base class for mesh structures, handling basic vertex functionality.
Definition: Vertices.h:51
SurgSim::DataStructures::OptionalValue::getValue
const T & getValue() const
Gets the value.
Definition: OptionalValue.h:78