CurveRepresentation.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_CURVEREPRESENTATION_H
#define SURGSIM_GRAPHICS_CURVEREPRESENTATION_H
#include "SurgSim/DataStructures/Vertices.h"
#include "SurgSim/Framework/LockedContainer.h"
#include "SurgSim/Graphics/Representation.h"
namespace SurgSim
{
namespace Graphics
{
class CurveRepresentation : public virtual Representation
{
public:
explicit CurveRepresentation(const std::string& name);
virtual void setSubdivisions(size_t num) = 0;
virtual size_t getSubdivisions() const = 0;
virtual void setTension(double tension) = 0;
virtual double getTension() const = 0;
virtual void setColor(const SurgSim::Math::Vector4d& color) = 0;
virtual Math::Vector4d getColor() const = 0;
virtual void setWidth(double width) = 0;
virtual double getWidth() const = 0;
virtual void setAntiAliasing(bool val) = 0;
virtual bool isAntiAliasing() const = 0;
void updateControlPoints(const DataStructures::VerticesPlain& vertices);
void updateControlPoints(DataStructures::VerticesPlain&& vertices);
protected:
Framework::LockedContainer<DataStructures::VerticesPlain> m_locker;
};
}
}
#endif
SurgSim::Graphics::CurveRepresentation::setTension
virtual void setTension(double tension)=0
Sets the tension (tau) parameter of the Catmull Rom interpolation, needs to be between 0...
SurgSim
Definition: CompoundShapeToGraphics.cpp:29
Vertices.h
SurgSim::Graphics::CurveRepresentation::CurveRepresentation
CurveRepresentation(const std::string &name)
Constructor.
Definition: CurveRepresentation.cpp:27
SurgSim::Graphics::CurveRepresentation
This implements a graphical object to draw an interpolated curve, it accepts a series of control poin...
Definition: CurveRepresentation.h:34
SurgSim::Graphics::CurveRepresentation::setSubdivisions
virtual void setSubdivisions(size_t num)=0
Sets the number of intermediate points the get generated between each two control points...
SurgSim::Graphics::CurveRepresentation::setColor
virtual void setColor(const SurgSim::Math::Vector4d &color)=0
Sets the color for the curve.
LockedContainer.h
SurgSim::Graphics::CurveRepresentation::updateControlPoints
void updateControlPoints(const DataStructures::VerticesPlain &vertices)
Updates the control points for this class, this will cause a new curve to be generated on the next up...
Definition: CurveRepresentation.cpp:44
SurgSim::Graphics::CurveRepresentation::setWidth
virtual void setWidth(double width)=0
Sets the line width to be used for drawing this curve.
Representation.h
SurgSim::Graphics::CurveRepresentation::setAntiAliasing
virtual void setAntiAliasing(bool val)=0
Sets up whether to use anti aliasing on the curve or not.
SurgSim::Graphics::CurveRepresentation::getTension
virtual double getTension() const =0
SurgSim::Graphics::Representation
Base graphics representation class, which defines the interface that all graphics representations mus...
Definition: Representation.h:39
SurgSim::Graphics::CurveRepresentation::getSubdivisions
virtual size_t getSubdivisions() const =0
SurgSim::Graphics::CurveRepresentation::getWidth
virtual double getWidth() const =0
SurgSim::Framework::LockedContainer
A simple thread-safe data container that can support multiple writers and readers.
Definition: LockedContainer.h:54
SurgSim::Graphics::CurveRepresentation::m_locker
Framework::LockedContainer< DataStructures::VerticesPlain > m_locker
Container control points, threadsafe access when updating.
Definition: CurveRepresentation.h:92
SurgSim::Graphics::CurveRepresentation::getColor
virtual Math::Vector4d getColor() const =0
SurgSim::Math::Vector4d
Eigen::Matrix< double, 4, 1 > Vector4d
A 4D vector of doubles.
Definition: Vector.h:61
SurgSim::DataStructures::Vertices
Base class for mesh structures, handling basic vertex functionality.
Definition: Vertices.h:51
SurgSim::Graphics::CurveRepresentation::isAntiAliasing
virtual bool isAntiAliasing() const =0