/usr/include/tulip/DrawingTools.h is in libtulip-dev 4.8.0dfsg-2build2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 | /*
*
* This file is part of Tulip (www.tulip-software.org)
*
* Authors: David Auber and the Tulip development Team
* from LaBRI, University of Bordeaux
*
* Tulip is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3
* of the License, or (at your option) any later version.
*
* Tulip is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*/
///@cond DOXYGEN_HIDDEN
#ifndef _DRAWINGTOOLS_H
#define _DRAWINGTOOLS_H
#include <vector>
#include <tulip/Node.h>
#include <tulip/Edge.h>
#include <tulip/Coord.h>
#include <tulip/BoundingBox.h>
#include <tulip/Matrix.h>
#include <tulip/Size.h>
namespace tlp {
template<class itType >
struct Iterator;
class Graph;
class LayoutProperty;
class SizeProperty;
class DoubleProperty;
class BooleanProperty;
typedef Matrix<float, 3> Mat3f;
/**
*
* Computes the bounding box of a graph according to nodes positions, edges bends,
* nodes z-rotations and sizes of elements.
*
*/
TLP_SCOPE BoundingBox computeBoundingBox(const Graph *graph,
const LayoutProperty *layout,
const SizeProperty *size,
const DoubleProperty *rotation,
const BooleanProperty *selection = NULL);
//======================================================================================================
/**
* Compute the bounding box of graph elements according to node positions, edges bends,
* nodes z-rotations and sizes of elements.
*
* Iterator itN and itE will be deleted after the computations (i.e. no need to delete them yourself).
*/
TLP_SCOPE BoundingBox computeBoundingBox(Iterator<node> *itN,
Iterator<edge> *itE,
const LayoutProperty *layout,
const SizeProperty *size,
const DoubleProperty *rotation,
const BooleanProperty *selection = NULL);
//======================================================================================================
/**
*
* Computes a bounding sphere (or a bounding circle if the graph has a 2D layout) of a graph according to nodes positions, edges bends,
* nodes z-rotations and sizes of elements.
*
* Returns a pair of tlp::Coord whose first member is the center of the bounding sphere (circle for 2D layout)
* and second member is the farthest point from the center (computed from graph elements positions).
* To get the bounding radius, you have to compute the distance between the two members of the pair
* (use the dist method from tlp::Coord).
*
*/
TLP_SCOPE std::pair<Coord, Coord> computeBoundingRadius (const Graph *graph,
const LayoutProperty *layout,
const SizeProperty *size,
const DoubleProperty *rotation,
const BooleanProperty *selection = NULL);
//======================================================================================================
/**
*
* Computes a convex hull of a graph according to nodes positions, edges bends,
* nodes z-rotations, and sizes of elements. Only works with 2D layouts.
*
* Returns a vector of tlp::Coord containing the vertices of the graph convex hull correctly ordered.
*
*/
TLP_SCOPE std::vector<Coord> computeConvexHull (const Graph *graph,
const LayoutProperty *layout,
const SizeProperty *size,
const DoubleProperty *rotation,
const BooleanProperty *selection = NULL);
//======================================================================================================
/**
*
* Computes a convex hull of a set of points,
* Only works with 2D layouts.
*
* Returns a vector of tlp::Coord containing the vertices of the points convex hull correctly ordered.
*
*/
TLP_SCOPE std::vector<Coord> computeConvexHull(const std::vector<tlp::Coord> &points);
//======================================================================================================
/**
* Computes the intersection point (if any) of two 3d lines.
* Returns true if the line intersects, false otherwise (parallel or skew lines).
*
*/
TLP_SCOPE bool computeLinesIntersection(const std::pair<tlp::Coord, tlp::Coord> &line1,
const std::pair<tlp::Coord, tlp::Coord> &line2,
tlp::Coord &intersectionPoint);
//======================================================================================================
/**
* Computes the centroid of a polygon.
* Polygon vertices must be provided correctly ordered in the points vector.
*
*/
TLP_SCOPE tlp::Coord computePolygonCentroid(const std::vector<tlp::Coord> &points);
//======================================================================================================
/**
* Checks if a layout is co-planar, returns true if so.
* If the layout is co-planar, the inverse transform matrix is also returned
* in order to project the layout in the z=0 plane.
*
*/
TLP_SCOPE bool isLayoutCoPlanar(const std::vector<Coord> &points, Mat3f &invTransformMatrix);
//======================================================================================================
/**
* Computes the vertices of a regular polygon.
* A regular polygon is a polygon that is equiangular (all angles are equal in measure)
* and equilateral (all sides have the same length).
*
* @since Tulip 4.8
*
* @param numberOfSides the number of sides of the polygon (minimum value is 3)
* @param center the center point of the polygon
* @param size the size of the rectangle enclosing the polygon in the form (width/2, height/2)
* @param startAngle the start angle when computing the polygon vertices
* @return a vector filled with the numberOfSides polygon vertices
*
*/
TLP_SCOPE std::vector<tlp::Coord> computeRegularPolygon(unsigned int numberOfSides, const tlp::Coord ¢er,
const tlp::Size &size, float startAngle = 0);
}
#endif
///@endcond
|