ellipsoid_tree 0.1.0
Exact intersection tests for ellipsoids and friends
Loading...
Searching...
No Matches
ellipsoid_tree::Plot2D Class Reference

A world-coordinate 2D scene of drawable primitives with SVG and PNG writers. More...

#include <ellipsoid_tree/plot2d.hpp>

Public Member Functions

void add (const Ellipsoid &E, double tau, const Style &style)
 Add geometric objects (world coordinates, y up)
 
void add (const Ball &B, const Style &style)
 Add a ball to the scene.
 
void add (const Box &B, const Style &style)
 Add an axis-aligned box to the scene.
 
void add (const Segment &S, const Style &style)
 Add a line segment to the scene.
 
void add (const Simplex &S, const Style &style)
 Add a simplex (drawn as a point, segment, or filled polygon) to the scene.
 
void add (const Halfspace &H, const Style &style)
 Add a halfspace, drawn as a boundary line clipped to the plot bounds.
 
void add_marker (const Eigen::Ref< const Eigen::Vector2d > &pt, double radius_px, const Style &style)
 Marker radius is in canvas pixels (independent of zoom)
 
void add_polyline (const Eigen::Ref< const Eigen::MatrixXd > &pts, const Style &style, bool closed=false)
 Add a polyline through the given points, or a closed polygon when closed is true.
 
void add_text (const Eigen::Ref< const Eigen::Vector2d > &pt, std::string text, double size_px=12.0, Color color=colors::black(), TextAnchor anchor=TextAnchor::start)
 Add a text label at pt (text size in canvas pixels).
 
void add_cg1_triangle (const Eigen::Ref< const Eigen::MatrixXd > &pts, double t0, double t1, double t2)
 Triangle carrying normalized scalar values t in [0, 1] at its vertices: the PNG backend interpolates the VALUE barycentrically per pixel and applies the viridis colormap there, so the colormap curve is followed exactly even on coarse meshes (unlike Gouraud color interpolation).
 
void add_filled_triangle (const Eigen::Ref< const Eigen::MatrixXd > &pts, const Color &c0, const Color &c1, const Color &c2)
 Triangle with per-vertex colors: barycentric color interpolation in the PNG backend (Gouraud); flat average-color fill in SVG.
 
void axes (bool on)
 Axes with the physical extents of the drawn data (on by default)
 
void set_bounds (const Box &bounds)
 Override the automatic (data + 5% pad) plot bounds.
 
void save_svg (const std::string &path, int width_px=900) const
 Write the figure to an SVG file at the given pixel width.
 
std::string to_svg (int width_px=900) const
 Return the figure as an SVG document string at the given pixel width.
 
RenderedImage render_rgb (int width_px=900) const
 Rasterize the figure (white background, 1px antialiasing).
 
void save_png (const std::string &path, int width_px=900) const
 Write the figure to a PNG file at the given pixel width.
 

Detailed Description

A world-coordinate 2D scene of drawable primitives with SVG and PNG writers.

Member Function Documentation

◆ add() [1/6]

void ellipsoid_tree::Plot2D::add ( const Ellipsoid E,
double  tau,
const Style style 
)
inline

Add geometric objects (world coordinates, y up)

◆ add() [2/6]

void ellipsoid_tree::Plot2D::add ( const Ball B,
const Style style 
)
inline

Add a ball to the scene.

◆ add() [3/6]

void ellipsoid_tree::Plot2D::add ( const Box B,
const Style style 
)
inline

Add an axis-aligned box to the scene.

◆ add() [4/6]

void ellipsoid_tree::Plot2D::add ( const Segment S,
const Style style 
)
inline

Add a line segment to the scene.

◆ add() [5/6]

void ellipsoid_tree::Plot2D::add ( const Simplex S,
const Style style 
)
inline

Add a simplex (drawn as a point, segment, or filled polygon) to the scene.

◆ add() [6/6]

void ellipsoid_tree::Plot2D::add ( const Halfspace H,
const Style style 
)
inline

Add a halfspace, drawn as a boundary line clipped to the plot bounds.

◆ add_marker()

void ellipsoid_tree::Plot2D::add_marker ( const Eigen::Ref< const Eigen::Vector2d > &  pt,
double  radius_px,
const Style style 
)
inline

Marker radius is in canvas pixels (independent of zoom)

◆ add_polyline()

void ellipsoid_tree::Plot2D::add_polyline ( const Eigen::Ref< const Eigen::MatrixXd > &  pts,
const Style style,
bool  closed = false 
)
inline

Add a polyline through the given points, or a closed polygon when closed is true.

◆ add_text()

void ellipsoid_tree::Plot2D::add_text ( const Eigen::Ref< const Eigen::Vector2d > &  pt,
std::string  text,
double  size_px = 12.0,
Color  color = colors::black(),
TextAnchor  anchor = TextAnchor::start 
)
inline

Add a text label at pt (text size in canvas pixels).

◆ add_cg1_triangle()

void ellipsoid_tree::Plot2D::add_cg1_triangle ( const Eigen::Ref< const Eigen::MatrixXd > &  pts,
double  t0,
double  t1,
double  t2 
)
inline

Triangle carrying normalized scalar values t in [0, 1] at its vertices: the PNG backend interpolates the VALUE barycentrically per pixel and applies the viridis colormap there, so the colormap curve is followed exactly even on coarse meshes (unlike Gouraud color interpolation).

SVG falls back to a flat fill at the mean value.

◆ add_filled_triangle()

void ellipsoid_tree::Plot2D::add_filled_triangle ( const Eigen::Ref< const Eigen::MatrixXd > &  pts,
const Color c0,
const Color c1,
const Color c2 
)
inline

Triangle with per-vertex colors: barycentric color interpolation in the PNG backend (Gouraud); flat average-color fill in SVG.

pts has shape (2, 3).

◆ axes()

void ellipsoid_tree::Plot2D::axes ( bool  on)
inline

Axes with the physical extents of the drawn data (on by default)

◆ set_bounds()

void ellipsoid_tree::Plot2D::set_bounds ( const Box bounds)
inline

Override the automatic (data + 5% pad) plot bounds.

◆ save_svg()

void ellipsoid_tree::Plot2D::save_svg ( const std::string &  path,
int  width_px = 900 
) const
inline

Write the figure to an SVG file at the given pixel width.

◆ to_svg()

std::string ellipsoid_tree::Plot2D::to_svg ( int  width_px = 900) const
inline

Return the figure as an SVG document string at the given pixel width.

◆ render_rgb()

RenderedImage ellipsoid_tree::Plot2D::render_rgb ( int  width_px = 900) const
inline

Rasterize the figure (white background, 1px antialiasing).

◆ save_png()

void ellipsoid_tree::Plot2D::save_png ( const std::string &  path,
int  width_px = 900 
) const
inline

Write the figure to a PNG file at the given pixel width.


The documentation for this class was generated from the following file: