#include <iostream>
#include <algorithm>
#include <fstream>
#include <math.h>
#include <map>
#include <deque>
#include <vector>
#include <string>
#include <sstream>
#include <iomanip>
#include <memory>
#include <type_traits>
#include <typeinfo>
Go to the source code of this file.
|
| SVG |
| Main namespace for SVG for C++.
|
|
| util |
| Various utility and mathematical functions.
|
|
|
#define | PI 3.14159265 |
|
#define | SVG_TYPE_CHECK static_assert(std::is_base_of<Element, T>::value, "Child must be an SVG element.") |
|
#define | APPROX_EQUALS(x, y, tol) bool(abs(x - y) < tol) |
|
|
using | SVG::SelectorProperties = std::map< std::string, AttributeMap > |
|
using | SVG::SVGAttrib = std::map< std::string, std::string > |
|
using | SVG::Point = std::pair< double, double > |
|
using | SVG::Margins = QuadCoord |
|
|
enum | Orientation { COLINEAR,
CLOCKWISE,
COUNTERCLOCKWISE
} |
|
|
std::string | SVG::to_string (const double &value) |
|
std::string | SVG::to_string (const Point &point) |
|
std::string | SVG::to_string (const std::map< std::string, AttributeMap > &css, const size_t indent_level=0) |
|
std::vector< Point > | SVG::bounding_polygon (const std::vector< Shape *> &shapes) |
|
SVG | SVG::frame_animate (std::vector< SVG > &frames, const double fps) |
|
SVG | SVG::merge (SVG &left, SVG &right, const Margins &margins=DEFAULT_MARGINS) |
|
std::vector< Point > | SVG::util::polar_points (int n, int a, int b, double radius) |
|
template<typename T > |
T | SVG::util::min_or_not_nan (T first, T second) |
|
template<typename T > |
T | SVG::util::max_or_not_nan (T first, T second) |
|
Orientation | SVG::util::orientation (Point &p1, Point &p2, Point &p3) |
|
std::vector< Point > | SVG::util::convex_hull (std::vector< Point > &points) |
|
std::vector< Point > | SVG::bounding_polygon (std::vector< Shape *> &shapes) |
|
◆ convex_hull()
std::vector<Point> SVG::util::convex_hull |
( |
std::vector< Point > & |
points | ) |
|
|
inline |
◆ max_or_not_nan()
template<typename T >
T SVG::util::max_or_not_nan |
( |
T |
first, |
|
|
T |
second |
|
) |
| |
|
inline |
Return the largest number or the number that is not NAN Returns NAN if both are NAN
◆ min_or_not_nan()
template<typename T >
T SVG::util::min_or_not_nan |
( |
T |
first, |
|
|
T |
second |
|
) |
| |
|
inline |
Return the smallest number or the number that is not NAN Returns NAN if both are NAN
◆ polar_points()
std::vector< Point > SVG::util::polar_points |
( |
int |
n, |
|
|
int |
a, |
|
|
int |
b, |
|
|
double |
radius |
|
) |
| |
|
inline |
Return n equidistant points (oriented counterclockwise) located on the perimeter of a circle of radius r centered at (a, b)
Note: Drawing an edge between each consecutive pair of points creates a convex polygon
Return n equidistant points (oriented counterclockwise) located on the perimeter of a circle of radius r centered at (a, b)
Note: Drawing an edge between each consecutive pair of points creates a convex polygon