Class VectorVisualizer#
Defined in File VizUtils.h
Inheritance Relationships#
Base Type#
public Karana::Core::Base(Class Base)
Derived Types#
public Karana::KUtils::FrameToFrameVectorVisualizer(Class FrameToFrameVectorVisualizer)public Karana::KUtils::ScaledVectorVisualizer(Class ScaledVectorVisualizer)
Class Documentation#
-
class VectorVisualizer : public Karana::Core::Base#
Visualize a vector using a frame and a function.
The frame is origin of the vector, and the function provides the length/direction for the vector.
Subclassed by Karana::KUtils::FrameToFrameVectorVisualizer, Karana::KUtils::ScaledVectorVisualizer
Public Functions
-
VectorVisualizer(std::string_view name, const kc::ks_ptr<kf::Frame> &frame, const kc::ks_ptr<ks::ProxyScene> &scene, std::function<km::Vec3()> fn)#
VectorVisualizer constructor. The constructor is not meant to be called directly. Please use the create(…) method instead to create an instance.
- Parameters:
name – Name of the visualizer.
frame – The Frame where the vector starts.
scene – The ProxyScene to add the vector to.
fn – The function used to update the vector.
-
float getRadius()#
Get the radius of the vector.
- Returns:
The radius of the vector.
-
void setRadius(float radius)#
Set the radius of the vector.
- Parameters:
radius – The new radius of the vector.
-
ks::Color getColor()#
Get the color of the vector.
- Returns:
The color of the vector.
-
void setColor(ks::Color color)#
Set the color of the vector.
- Parameters:
color – The new color of the vector.
-
const km::Vec3 &getStartOffset()#
Get the starting offset of the vector.
This is the offset between the frame origin and the start of the vector.
- Returns:
The start offset of the vector.
-
void setStartOffset(const km::Vec3 &offset)#
Set the start offset of the vector.
This is the offset between the frame origin and the start of the vector.
- Parameters:
offset – The new start offset of the vector.
-
virtual void registerCallback()#
Register the callback with the scene.
-
void unregisterCallback()#
Unregister the callback with the scene.
Public Static Functions
-
static kc::ks_ptr<VectorVisualizer> create(std::string_view name, const kc::ks_ptr<kf::Frame> &frame, const kc::ks_ptr<ks::ProxyScene> &scene, std::function<km::Vec3()> fn)#
Create a new instance of VectorVisualizer.
- Parameters:
name – Name of the visualizer.
frame – The Frame where the vector starts.
scene – The ProxyScene to add the vector to.
fn – The function used to update the vector.
- Returns:
A pointer to the newly created VectorVisualizer.
Protected Attributes
-
ks::Color _color = ks::Color::RED#
The color of the vector.
-
float _radius = 0.075f#
The radius of the vector.
-
double _radius_ratio = 1.0#
The scalar to use when setting the scale of the vector.
-
km::Vec3 _start_offset = {0.0, 0.0, 0.0}#
The starting offset of the vector.
-
kc::ks_ptr<ks::ProxySceneNode> _node#
SceneNode to attach the rod and tip to.
-
kc::ks_ptr<ks::ScenePart> _rod#
Rod of the vector.
-
kc::ks_ptr<ks::ScenePart> _tip#
Tip of the vector.
-
std::function<km::Vec3()> _fn#
The vector update function.
-
bool _callback_registered = false#
Whether or not the callback has been registered with the scene.
-
std::string _callback_name#
The name of the scene callback.
-
std::weak_ptr<ks::ProxyScene> _scene#
A pointer to the ProxyScene.
-
VectorVisualizer(std::string_view name, const kc::ks_ptr<kf::Frame> &frame, const kc::ks_ptr<ks::ProxyScene> &scene, std::function<km::Vec3()> fn)#