Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/freestyle/intern/geometry')
-rw-r--r--source/blender/freestyle/intern/geometry/Bezier.cpp6
-rw-r--r--source/blender/freestyle/intern/geometry/FastGrid.cpp4
-rw-r--r--source/blender/freestyle/intern/geometry/FastGrid.h2
-rw-r--r--source/blender/freestyle/intern/geometry/FitCurve.cpp32
-rw-r--r--source/blender/freestyle/intern/geometry/GeomCleaner.cpp2
-rw-r--r--source/blender/freestyle/intern/geometry/GeomUtils.cpp17
-rw-r--r--source/blender/freestyle/intern/geometry/GeomUtils.h2
-rw-r--r--source/blender/freestyle/intern/geometry/Grid.cpp11
-rw-r--r--source/blender/freestyle/intern/geometry/Grid.h22
-rw-r--r--source/blender/freestyle/intern/geometry/GridHelpers.h2
-rw-r--r--source/blender/freestyle/intern/geometry/HashGrid.cpp4
-rw-r--r--source/blender/freestyle/intern/geometry/HashGrid.h4
-rw-r--r--source/blender/freestyle/intern/geometry/Polygon.h4
-rw-r--r--source/blender/freestyle/intern/geometry/SweepLine.h62
-rw-r--r--source/blender/freestyle/intern/geometry/VecMat.h9
-rw-r--r--source/blender/freestyle/intern/geometry/normal_cycle.cpp6
16 files changed, 97 insertions, 92 deletions
diff --git a/source/blender/freestyle/intern/geometry/Bezier.cpp b/source/blender/freestyle/intern/geometry/Bezier.cpp
index 9140f1f947d..b332553f0b4 100644
--- a/source/blender/freestyle/intern/geometry/Bezier.cpp
+++ b/source/blender/freestyle/intern/geometry/Bezier.cpp
@@ -58,7 +58,7 @@ void BezierCurveSegment::Build()
return;
// Compute the rightmost part of the matrix:
- vector<Vec2d>::const_iterator p0,p1,p2,p3;
+ vector<Vec2d>::const_iterator p0, p1, p2, p3;
p0 = _ControlPolygon.begin();
p1 = p0;
++p1;
@@ -101,7 +101,7 @@ BezierCurve::BezierCurve(vector<Vec2d>& iPoints, double error)
fitcurve.FitCurve(iPoints, curve, error);
int i = 0;
- vector<Vec2d>::iterator v,vend;
+ vector<Vec2d>::iterator v, vend;
for (v = curve.begin(), vend = curve.end(); v != vend; ++v) {
if ((i == 0) || (i % 4 != 0))
AddControlPoint(*v);
@@ -111,7 +111,7 @@ BezierCurve::BezierCurve(vector<Vec2d>& iPoints, double error)
BezierCurve::~BezierCurve()
{
- if(_currentSegment)
+ if (_currentSegment)
delete _currentSegment;
}
diff --git a/source/blender/freestyle/intern/geometry/FastGrid.cpp b/source/blender/freestyle/intern/geometry/FastGrid.cpp
index 7051d960346..37871eadcec 100644
--- a/source/blender/freestyle/intern/geometry/FastGrid.cpp
+++ b/source/blender/freestyle/intern/geometry/FastGrid.cpp
@@ -25,7 +25,7 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/geometry/FastGrid.h
+/** \file blender/freestyle/intern/geometry/FastGrid.cpp
* \ingroup freestyle
* \brief Class to define a cell grid surrounding the bounding box of the scene
* \author Stephane Grabli
@@ -56,7 +56,7 @@ void FastGrid::configure(const Vec3r& orig, const Vec3r& size, unsigned nb)
{
Grid::configure(orig, size, nb);
_cells_size = _cells_nb[0] * _cells_nb[1] * _cells_nb[2];
- _cells = new Cell*[_cells_size];
+ _cells = new Cell *[_cells_size];
memset(_cells, 0, _cells_size * sizeof(*_cells));
}
diff --git a/source/blender/freestyle/intern/geometry/FastGrid.h b/source/blender/freestyle/intern/geometry/FastGrid.h
index 3a2ed392533..cf5f911497a 100644
--- a/source/blender/freestyle/intern/geometry/FastGrid.h
+++ b/source/blender/freestyle/intern/geometry/FastGrid.h
@@ -73,7 +73,7 @@ public:
virtual void configure(const Vec3r& orig, const Vec3r& size, unsigned nb);
/*! returns the cell whose coordinates are pased as argument */
- Cell* getCell(const Vec3u& p);
+ Cell *getCell(const Vec3u& p);
/*! Fills the case p with the cell iCell */
virtual void fillCell(const Vec3u& p, Cell& cell);
diff --git a/source/blender/freestyle/intern/geometry/FitCurve.cpp b/source/blender/freestyle/intern/geometry/FitCurve.cpp
index 4eae543c9f9..cb338be8cf3 100644
--- a/source/blender/freestyle/intern/geometry/FitCurve.cpp
+++ b/source/blender/freestyle/intern/geometry/FitCurve.cpp
@@ -154,7 +154,7 @@ static BezierCurve GenerateBezier(Vector2 *d, int first, int last, double *uPri
Vector2 tmp; /* Utility variable */
BezierCurve bezCurve; /* RETURN bezier curve ctl pts */
- bezCurve = (Vector2*)malloc(4 * sizeof(Vector2));
+ bezCurve = (Vector2 *)malloc(4 * sizeof(Vector2));
nPts = last - first + 1;
/* Compute the A's */
@@ -246,9 +246,9 @@ static double *Reparameterize(Vector2 *d, int first, int last, double *u, Bezier
int i;
double *uPrime; /* New parameter values */
- uPrime = (double*)malloc(nPts * sizeof(double));
+ uPrime = (double *)malloc(nPts * sizeof(double));
for (i = first; i <= last; i++) {
- uPrime[i-first] = NewtonRaphsonRootFind(bezCurve, d[i], u[i - first]);
+ uPrime[i - first] = NewtonRaphsonRootFind(bezCurve, d[i], u[i - first]);
}
return (uPrime);
}
@@ -313,21 +313,21 @@ static Vector2 BezierII(int degree, Vector2 *V, double t)
Vector2 *Vtemp; /* Local copy of control points */
/* Copy array */
- Vtemp = (Vector2*)malloc((unsigned)((degree + 1) * sizeof (Vector2)));
+ Vtemp = (Vector2 *)malloc((unsigned)((degree + 1) * sizeof(Vector2)));
for (i = 0; i <= degree; i++) {
Vtemp[i] = V[i];
}
/* Triangle computation */
for (i = 1; i <= degree; i++) {
- for (j = 0; j <= degree-i; j++) {
+ for (j = 0; j <= degree - i; j++) {
Vtemp[j][0] = (1.0 - t) * Vtemp[j][0] + t * Vtemp[j + 1][0];
Vtemp[j][1] = (1.0 - t) * Vtemp[j][1] + t * Vtemp[j + 1][1];
}
}
Q = Vtemp[0];
- free((void*)Vtemp);
+ free((void *)Vtemp);
return Q;
}
@@ -411,7 +411,7 @@ static double *ChordLengthParameterize(Vector2 *d, int first, int last)
int i;
double *u; /* Parameterization */
- u = (double*)malloc((unsigned)(last - first + 1) * sizeof(double));
+ u = (double *)malloc((unsigned)(last - first + 1) * sizeof(double));
u[0] = 0.0;
for (i = first + 1; i <= last; i++) {
@@ -551,13 +551,13 @@ void FitCurveWrapper::FitCubic(Vector2 *d, int first, int last, Vector2 tHat1, V
if (nPts == 2) {
double dist = V2DistanceBetween2Points(&d[last], &d[first]) / 3.0;
- bezCurve = (Vector2*)malloc(4 * sizeof(Vector2));
+ bezCurve = (Vector2 *)malloc(4 * sizeof(Vector2));
bezCurve[0] = d[first];
bezCurve[3] = d[last];
V2Add(&bezCurve[0], V2Scale(&tHat1, dist), &bezCurve[1]);
V2Add(&bezCurve[3], V2Scale(&tHat2, dist), &bezCurve[2]);
DrawBezierCurve(3, bezCurve);
- free((void*)bezCurve);
+ free((void *)bezCurve);
return;
}
@@ -569,8 +569,8 @@ void FitCurveWrapper::FitCubic(Vector2 *d, int first, int last, Vector2 tHat1, V
maxError = ComputeMaxError(d, first, last, bezCurve, u, &splitPoint);
if (maxError < error) {
DrawBezierCurve(3, bezCurve);
- free((void*)u);
- free((void*)bezCurve);
+ free((void *)u);
+ free((void *)bezCurve);
return;
}
@@ -583,18 +583,18 @@ void FitCurveWrapper::FitCubic(Vector2 *d, int first, int last, Vector2 tHat1, V
bezCurve, uPrime, &splitPoint);
if (maxError < error) {
DrawBezierCurve(3, bezCurve);
- free((void*)u);
- free((void*)bezCurve);
+ free((void *)u);
+ free((void *)bezCurve);
return;
}
- free((void*)u);
+ free((void *)u);
u = uPrime;
}
}
/* Fitting failed -- split at max error point and fit recursively */
- free((void*)u);
- free((void*)bezCurve);
+ free((void *)u);
+ free((void *)bezCurve);
tHatCenter = ComputeCenterTangent(d, splitPoint);
FitCubic(d, first, splitPoint, tHat1, tHatCenter, error);
V2Negate(&tHatCenter);
diff --git a/source/blender/freestyle/intern/geometry/GeomCleaner.cpp b/source/blender/freestyle/intern/geometry/GeomCleaner.cpp
index c90513c6294..dc9618a1a45 100644
--- a/source/blender/freestyle/intern/geometry/GeomCleaner.cpp
+++ b/source/blender/freestyle/intern/geometry/GeomCleaner.cpp
@@ -177,7 +177,7 @@ void GeomCleaner::SortAndCompressIndexedVertexArray(const float *iVertices, unsi
}
/*! Defines a hash table used for searching the Cells */
-struct GeomCleanerHasher{
+struct GeomCleanerHasher {
#define _MUL 950706376UL
#define _MOD 2147483647UL
inline size_t operator() (const Vec3r& p) const
diff --git a/source/blender/freestyle/intern/geometry/GeomUtils.cpp b/source/blender/freestyle/intern/geometry/GeomUtils.cpp
index c0cd9450480..8d6317c9b07 100644
--- a/source/blender/freestyle/intern/geometry/GeomUtils.cpp
+++ b/source/blender/freestyle/intern/geometry/GeomUtils.cpp
@@ -37,7 +37,7 @@
namespace GeomUtils {
// This internal procedure is defined below.
-bool intersect2dSegPoly(Vec2r* seg, Vec2r* poly, unsigned n);
+bool intersect2dSegPoly(Vec2r *seg, Vec2r *poly, unsigned n);
bool intersect2dSeg2dArea(const Vec2r& min, const Vec2r& max, const Vec2r& A, const Vec2r& B)
{
@@ -64,7 +64,9 @@ bool include2dSeg2dArea(const Vec2r& min, const Vec2r& max, const Vec2r& A, cons
{
if ((((max[0] > A[0]) && (A[0] > min[0])) && ((max[0] > B[0]) && (B[0] > min[0]))) &&
(((max[1] > A[1]) && (A[1] > min[1])) && ((max[1] > B[1]) && (B[1] > min[1]))))
+ {
return true;
+ }
return false;
}
@@ -512,9 +514,9 @@ bool intersectRayBBox(const Vec3r& orig, const Vec3r& dir, // ray origin an
bounds[1] = boxMax;
tmin = (bounds[sign[0]].x() - orig.x()) * inv_direction.x();
- tmax = (bounds[1-sign[0]].x() - orig.x()) * inv_direction.x();
+ tmax = (bounds[1 - sign[0]].x() - orig.x()) * inv_direction.x();
tymin = (bounds[sign[1]].y() - orig.y()) * inv_direction.y();
- tymax = (bounds[1-sign[1]].y() - orig.y()) * inv_direction.y();
+ tymax = (bounds[1 - sign[1]].y() - orig.y()) * inv_direction.y();
if ((tmin > tymax) || (tymin > tmax))
return false;
if (tymin > tmin)
@@ -522,7 +524,7 @@ bool intersectRayBBox(const Vec3r& orig, const Vec3r& dir, // ray origin an
if (tymax < tmax)
tmax = tymax;
tzmin = (bounds[sign[2]].z() - orig.z()) * inv_direction.z();
- tzmax = (bounds[1-sign[2]].z() - orig.z()) * inv_direction.z();
+ tzmax = (bounds[1 - sign[2]].z() - orig.z()) * inv_direction.z();
if ((tmin > tzmax) || (tzmin > tmax))
return false;
if (tzmin > tmin)
@@ -587,7 +589,8 @@ void transformVertices(const vector<Vec3r>& vertices, const Matrix44r& trans, ve
}
}
-Vec3r rotateVector(const Matrix44r& mat, const Vec3r& v) {
+Vec3r rotateVector(const Matrix44r& mat, const Vec3r& v)
+{
Vec3r res;
for (unsigned int i = 0; i < 3; i++) {
res[i] = 0;
@@ -693,7 +696,7 @@ void fromCameraToWorld(const Vec3r& p, Vec3r& q, const real model_view_matrix[4]
#define PERP(u, v) ((u)[0] * (v)[1] - (u)[1] * (v)[0]) // 2D perp product
-inline bool intersect2dSegPoly(Vec2r* seg, Vec2r* poly, unsigned n)
+inline bool intersect2dSegPoly(Vec2r *seg, Vec2r *poly, unsigned n)
{
if (seg[0] == seg[1])
return false;
@@ -705,7 +708,7 @@ inline bool intersect2dSegPoly(Vec2r* seg, Vec2r* poly, unsigned n)
Vec2r e; // edge vector
for (unsigned int i = 0; i < n; i++) { // process polygon edge poly[i]poly[i+1]
- e = poly[i+1] - poly[i];
+ e = poly[i + 1] - poly[i];
N = PERP(e, seg[0] - poly[i]);
D = -PERP(e, dseg);
if (fabs(D) < M_EPSILON) {
diff --git a/source/blender/freestyle/intern/geometry/GeomUtils.h b/source/blender/freestyle/intern/geometry/GeomUtils.h
index 1b90f99c2ed..be20873e73b 100644
--- a/source/blender/freestyle/intern/geometry/GeomUtils.h
+++ b/source/blender/freestyle/intern/geometry/GeomUtils.h
@@ -53,7 +53,7 @@ namespace GeomUtils {
/*! Computes the distance from a point P to a segment AB */
template<class T>
-real distPointSegment( const T& P, const T& A , const T& B)
+real distPointSegment(const T& P, const T& A, const T& B)
{
T AB, AP, BP;
AB = B - A;
diff --git a/source/blender/freestyle/intern/geometry/Grid.cpp b/source/blender/freestyle/intern/geometry/Grid.cpp
index 11c4f11b281..0b798c5abb8 100644
--- a/source/blender/freestyle/intern/geometry/Grid.cpp
+++ b/source/blender/freestyle/intern/geometry/Grid.cpp
@@ -158,7 +158,7 @@ void Grid::configure(const Vec3r& orig, const Vec3r& size, unsigned nb)
_cell_size[i] = _size[i] / _cells_nb[i];
}
-void Grid::insertOccluder(Polygon3r* occluder)
+void Grid::insertOccluder(Polygon3r *occluder)
{
const vector<Vec3r> vertices = occluder->getVertices();
if (vertices.size() == 0)
@@ -208,7 +208,7 @@ void Grid::insertOccluder(Polygon3r* occluder)
if (GeomUtils::overlapTriangleBox(boxcenter, boxhalfsize, triverts)) {
// We must then create the Cell and add it to the cells list if it does not exist yet.
// We must then add the occluder to the occluders list of this cell.
- Cell* cell = getCell(coord);
+ Cell *cell = getCell(coord);
if (!cell) {
cell = new Cell(boxmin);
fillCell(coord, *cell);
@@ -226,7 +226,7 @@ void Grid::insertOccluder(Polygon3r* occluder)
coord[0] = x;
coord[1] = y;
coord[2] = z;
- Cell* cell = getCell(coord);
+ Cell *cell = getCell(coord);
if (!cell) {
Vec3r orig;
getCellOrigin(coord, orig);
@@ -311,7 +311,7 @@ void Grid::castInfiniteRay(const Vec3r& orig, const Vec3r& dir, OccludersSet& oc
castRayInternal(visitor);
}
-Polygon3r* Grid::castRayToFindFirstIntersection(const Vec3r& orig, const Vec3r& dir, double& t,
+Polygon3r *Grid::castRayToFindFirstIntersection(const Vec3r& orig, const Vec3r& dir, double& t,
double& u, double& v, unsigned timestamp)
{
Polygon3r *occluder = 0;
@@ -348,7 +348,8 @@ void Grid::initRay (const Vec3r &orig, const Vec3r& end, unsigned timestamp)
//_ray_occluders.clear();
}
-bool Grid::initInfiniteRay (const Vec3r &orig, const Vec3r& dir, unsigned timestamp) {
+bool Grid::initInfiniteRay (const Vec3r &orig, const Vec3r& dir, unsigned timestamp)
+{
_ray_dir = dir;
_t_end = FLT_MAX;
_t = 0;
diff --git a/source/blender/freestyle/intern/geometry/Grid.h b/source/blender/freestyle/intern/geometry/Grid.h
index 8b237673b8a..f37f7f615f0 100644
--- a/source/blender/freestyle/intern/geometry/Grid.h
+++ b/source/blender/freestyle/intern/geometry/Grid.h
@@ -71,7 +71,7 @@ public:
virtual ~Cell() {}
- inline void addOccluder(Polygon3r* o) {
+ inline void addOccluder(Polygon3r *o) {
if (o)
_occluders.push_back(o);
}
@@ -142,7 +142,7 @@ private:
public:
firstIntersectionGridVisitor(const Vec3r& ray_org, const Vec3r& ray_dir, const Vec3r& cell_size) :
- GridVisitor(), u_(0),v_(0),t_(DBL_MAX), occluder_(0), ray_org_(ray_org), ray_dir_(ray_dir),
+ GridVisitor(), u_(0), v_(0), t_(DBL_MAX), occluder_(0), ray_org_(ray_org), ray_dir_(ray_dir),
cell_size_(cell_size), current_cell_(0)
{
}
@@ -213,14 +213,14 @@ public:
virtual void fillCell(const Vec3u& coord, Cell& cell) = 0;
/*! returns the cell whose coordinates are pased as argument */
- virtual Cell* getCell(const Vec3u& coord) = 0;
+ virtual Cell *getCell(const Vec3u& coord) = 0;
/*! returns the cell containing the point passed as argument. If the cell is empty (contains no occluder),
* NULL is returned
* p
* The point for which we're looking the cell
*/
- inline Cell* getCell(const Vec3r& p) {
+ inline Cell *getCell(const Vec3r& p) {
Vec3u coord;
getCellCoordinates(p, coord);
return getCell(coord);
@@ -255,10 +255,10 @@ public:
* convex_poly
* The list of 3D points constituing a convex polygon
*/
- void insertOccluder(Polygon3r * convex_poly);
+ void insertOccluder(Polygon3r *convex_poly);
/*! Adds an occluder to the list of occluders */
- void addOccluder(Polygon3r* occluder) {
+ void addOccluder(Polygon3r *occluder) {
_occluders.push_back(occluder);
}
@@ -311,7 +311,7 @@ public:
}
//ARB profiling only:
- inline OccludersSet* getOccluders() {
+ inline OccludersSet *getOccluders() {
return &_occluders;
}
@@ -371,12 +371,12 @@ protected:
class VirtualOccludersSet {
public:
VirtualOccludersSet(Grid& _grid) : grid (_grid) {};
- Polygon3r* begin();
- Polygon3r* next();
- Polygon3r* next(bool stopOnNewCell);
+ Polygon3r *begin();
+ Polygon3r *next();
+ Polygon3r *next(bool stopOnNewCell);
private:
- Polygon3r* firstOccluderFromNextCell();
+ Polygon3r *firstOccluderFromNextCell();
Grid& grid;
OccludersSet::iterator it, end;
};
diff --git a/source/blender/freestyle/intern/geometry/GridHelpers.h b/source/blender/freestyle/intern/geometry/GridHelpers.h
index 4391b4f61a3..2503cb2ebbd 100644
--- a/source/blender/freestyle/intern/geometry/GridHelpers.h
+++ b/source/blender/freestyle/intern/geometry/GridHelpers.h
@@ -48,7 +48,7 @@ namespace GridHelpers {
/*! Computes the distance from a point P to a segment AB */
template<class T>
-T closestPointToSegment(const T& P, const T& A , const T& B, real& distance)
+T closestPointToSegment(const T& P, const T& A, const T& B, real& distance)
{
T AB, AP, BP;
AB = B - A;
diff --git a/source/blender/freestyle/intern/geometry/HashGrid.cpp b/source/blender/freestyle/intern/geometry/HashGrid.cpp
index b0ad9e0f276..3752fc2f32a 100644
--- a/source/blender/freestyle/intern/geometry/HashGrid.cpp
+++ b/source/blender/freestyle/intern/geometry/HashGrid.cpp
@@ -37,8 +37,8 @@
void HashGrid::clear()
{
if (!_cells.empty()) {
- for (GridHashTable::iterator it = _cells.begin(); it !=_cells.end(); it++) {
- Cell* cell = (*it).second;
+ for (GridHashTable::iterator it = _cells.begin(); it != _cells.end(); it++) {
+ Cell *cell = (*it).second;
delete cell;
}
_cells.clear();
diff --git a/source/blender/freestyle/intern/geometry/HashGrid.h b/source/blender/freestyle/intern/geometry/HashGrid.h
index ca6edb258a9..ea44196b523 100644
--- a/source/blender/freestyle/intern/geometry/HashGrid.h
+++ b/source/blender/freestyle/intern/geometry/HashGrid.h
@@ -93,9 +93,9 @@ public:
virtual void configure(const Vec3r& orig, const Vec3r& size, unsigned nb);
/*! returns the cell whose coordinates are pased as argument */
- virtual Cell* getCell(const Vec3u& p)
+ virtual Cell *getCell(const Vec3u& p)
{
- Cell* found_cell = NULL;
+ Cell *found_cell = NULL;
GridHashTable::const_iterator found = _cells.find(p);
if (found != _cells.end())
diff --git a/source/blender/freestyle/intern/geometry/Polygon.h b/source/blender/freestyle/intern/geometry/Polygon.h
index 5ee4353ef5a..e217a67b03e 100644
--- a/source/blender/freestyle/intern/geometry/Polygon.h
+++ b/source/blender/freestyle/intern/geometry/Polygon.h
@@ -162,8 +162,8 @@ public:
}
// FIXME Is it possible to get rid of userdatas ?
- void* userdata;
- void* userdata2; // Used during ray casting
+ void *userdata;
+ void *userdata2; // Used during ray casting
protected:
vector<Point> _vertices;
diff --git a/source/blender/freestyle/intern/geometry/SweepLine.h b/source/blender/freestyle/intern/geometry/SweepLine.h
index ec81507c5c6..d03bc2224c7 100644
--- a/source/blender/freestyle/intern/geometry/SweepLine.h
+++ b/source/blender/freestyle/intern/geometry/SweepLine.h
@@ -44,7 +44,7 @@ class Intersection
{
public:
template<class EdgeClass>
- Intersection(EdgeClass* eA, real ta, EdgeClass* eB, real tb)
+ Intersection(EdgeClass *eA, real ta, EdgeClass *eB, real tb)
{
EdgeA = eA;
EdgeB = eB;
@@ -109,7 +109,7 @@ public:
}
}
- Segment(Segment<T,Point>& iBrother)
+ Segment(Segment<T, Point>& iBrother)
{
_edge = iBrother.edge();
A = iBrother.A;
@@ -118,7 +118,7 @@ public:
_order = iBrother._order;
}
- Segment(const Segment<T,Point>& iBrother)
+ Segment(const Segment<T, Point>& iBrother)
{
_edge = iBrother._edge;
A = iBrother.A;
@@ -137,7 +137,7 @@ public:
return (i % 2 == 0) ? A : B;
}
- inline bool operator==(const Segment<T,Point>& iBrother)
+ inline bool operator==(const Segment<T, Point>& iBrother)
{
if (_edge == iBrother._edge)
return true;
@@ -145,13 +145,13 @@ public:
}
/* Adds an intersection for this segment */
- inline void AddIntersection(Intersection<Segment<T,Point> > *i)
+ inline void AddIntersection(Intersection<Segment<T, Point> > *i)
{
_Intersections.push_back(i);
}
/*! Checks for a common vertex with another edge */
- inline bool CommonVertex(const Segment<T,Point>& S, Point& CP)
+ inline bool CommonVertex(const Segment<T, Point>& S, Point& CP)
{
if ((A == S[0]) || (A == S[1])) {
CP = A;
@@ -164,7 +164,7 @@ public:
return false;
}
- inline vector<Intersection<Segment<T,Point> >*>& intersections()
+ inline vector<Intersection<Segment<T, Point> >*>& intersections()
{
return _Intersections;
}
@@ -183,7 +183,7 @@ private:
T _edge;
Point A;
Point B;
- std::vector<Intersection<Segment<T,Point> >*> _Intersections; // list of intersections parameters
+ std::vector<Intersection<Segment<T, Point> >*> _Intersections; // list of intersections parameters
bool _order; // true if A and B are in the same order than _edge.A and _edge.B. false otherwise.
};
@@ -198,7 +198,7 @@ template<class T1, class T2>
struct binary_rule
{
binary_rule() {}
- template<class T3,class T4> binary_rule(const binary_rule<T3,T4>& brother) {}
+ template<class T3, class T4> binary_rule(const binary_rule<T3, T4>& brother) {}
virtual ~binary_rule() {}
virtual bool operator()(T1&, T2&)
@@ -208,14 +208,14 @@ struct binary_rule
};
-template<class T,class Point>
+template<class T, class Point>
class SweepLine
{
public:
SweepLine() {}
~SweepLine()
{
- for (typename vector<Intersection<Segment<T,Point> >*>::iterator i = _Intersections.begin(),
+ for (typename vector<Intersection<Segment<T, Point> >*>::iterator i = _Intersections.begin(),
iend = _Intersections.end();
i != iend;
i++)
@@ -224,18 +224,18 @@ public:
}
}
- inline void process(Point& p, vector<Segment<T,Point>*>& segments,
+ inline void process(Point& p, vector<Segment<T, Point>*>& segments,
#if 0
- binary_rule<Segment<T,Point>,Segment<T,Point> >& binrule = \
- binary_rule<Segment<T,Point>,Segment<T,Point> >(),
+ binary_rule<Segment<T, Point>,Segment<T, Point> >& binrule = \
+ binary_rule<Segment<T, Point>, Segment<T, Point> >(),
#else
- binary_rule<Segment<T,Point>,Segment<T,Point> >& binrule,
+ binary_rule<Segment<T, Point>, Segment<T, Point> >& binrule,
#endif
real epsilon = M_EPSILON)
{
// first we remove the segments that need to be removed and then we add the segments to add
- vector<Segment<T,Point>*> toadd;
- typename vector<Segment<T,Point>*>::iterator s, send;
+ vector<Segment<T, Point>*> toadd;
+ typename vector<Segment<T, Point>*>::iterator s, send;
for (s = segments.begin(), send = segments.end(); s != send; s++) {
if (p == (*(*s))[0])
toadd.push_back((*s));
@@ -247,16 +247,16 @@ public:
}
}
- inline void add(Segment<T,Point>* S,
+ inline void add(Segment<T, Point> *S,
#if 0
- binary_rule<Segment<T,Point>,Segment<T,Point> >& binrule = \
- binary_rule<Segment<T,Point>, Segment<T,Point> >(),
+ binary_rule<Segment<T, Point>, Segment<T, Point> >& binrule = \
+ binary_rule<Segment<T, Point>, Segment<T, Point> >(),
#else
- binary_rule<Segment<T,Point>,Segment<T,Point> >& binrule,
+ binary_rule<Segment<T, Point>, Segment<T, Point> >& binrule,
#endif
real epsilon)
{
- real t,u;
+ real t, u;
Point CP;
Vec2r v0, v1, v2, v3;
if (true == S->order()) {
@@ -271,8 +271,8 @@ public:
v0[0] = ((*S)[1])[0];
v0[1] = ((*S)[1])[1];
}
- for (typename std::list<Segment<T,Point>* >::iterator s = _set.begin(), send = _set.end(); s != send; s++) {
- Segment<T,Point>* currentS = (*s);
+ for (typename std::list<Segment<T, Point> *>::iterator s = _set.begin(), send = _set.end(); s != send; s++) {
+ Segment<T, Point> *currentS = (*s);
if (true != binrule(*S, *currentS))
continue;
@@ -293,7 +293,7 @@ public:
if (GeomUtils::intersect2dSeg2dSegParametric(v0, v1, v2, v3, t, u, epsilon) == GeomUtils::DO_INTERSECT) {
// create the intersection
- Intersection<Segment<T,Point> > *inter = new Intersection<Segment<T,Point> >(S,t,currentS,u);
+ Intersection<Segment<T, Point> > *inter = new Intersection<Segment<T, Point> >(S, t, currentS, u);
// add it to the intersections list
_Intersections.push_back(inter);
// add this intersection to the first edge intersections list
@@ -306,27 +306,27 @@ public:
_set.push_back(S);
}
- inline void remove(Segment<T,Point>* s)
+ inline void remove(Segment<T, Point> *s)
{
if (s->intersections().size() > 0)
_IntersectedEdges.push_back(s);
_set.remove(s);
}
- vector<Segment<T,Point>* >& intersectedEdges()
+ vector<Segment<T, Point> *>& intersectedEdges()
{
return _IntersectedEdges;
}
- vector<Intersection<Segment<T,Point> >*>& intersections()
+ vector<Intersection<Segment<T, Point> >*>& intersections()
{
return _Intersections;
}
private:
- std::list<Segment<T,Point>* > _set; // set of active edges for a given position of the sweep line
- std::vector<Segment<T,Point>* > _IntersectedEdges; // the list of intersected edges
- std::vector<Intersection<Segment<T,Point> >*> _Intersections; // the list of all intersections.
+ std::list<Segment<T, Point> *> _set; // set of active edges for a given position of the sweep line
+ std::vector<Segment<T, Point> *> _IntersectedEdges; // the list of intersected edges
+ std::vector<Intersection<Segment<T, Point> > *> _Intersections; // the list of all intersections.
};
#endif // __SWEEPLINE_H__
diff --git a/source/blender/freestyle/intern/geometry/VecMat.h b/source/blender/freestyle/intern/geometry/VecMat.h
index 5b64a6e4502..34e10d31c4f 100644
--- a/source/blender/freestyle/intern/geometry/VecMat.h
+++ b/source/blender/freestyle/intern/geometry/VecMat.h
@@ -153,21 +153,21 @@ public:
return res;
}
- inline Vec<T, N> operator-(const Vec<T,N>& v) const
+ inline Vec<T, N> operator-(const Vec<T, N>& v) const
{
Vec<T, N> res(*this);
res -= v;
return res;
}
- inline Vec<T, N> operator*(const typename Vec<T,N>::value_type r) const
+ inline Vec<T, N> operator*(const typename Vec<T, N>::value_type r) const
{
Vec<T, N> res(*this);
res *= r;
return res;
}
- inline Vec<T, N> operator/(const typename Vec<T,N>::value_type r) const
+ inline Vec<T, N> operator/(const typename Vec<T, N>::value_type r) const
{
Vec<T, N> res(*this);
if (r)
@@ -435,7 +435,8 @@ public:
return this->_coord[1];
}
- inline value_type& sy(){
+ inline value_type& sy()
+ {
return this->_coord[1];
}
diff --git a/source/blender/freestyle/intern/geometry/normal_cycle.cpp b/source/blender/freestyle/intern/geometry/normal_cycle.cpp
index 2f0aa268c9f..63195b24386 100644
--- a/source/blender/freestyle/intern/geometry/normal_cycle.cpp
+++ b/source/blender/freestyle/intern/geometry/normal_cycle.cpp
@@ -82,15 +82,15 @@ void NormalCycle::end()
double l2 = ::fabs(eigen_value_[2]);
if (l1 > l0) {
- ogf_swap(l0 , l1 );
+ ogf_swap(l0, l1 );
ogf_swap(i_[0], i_[1]);
}
if (l2 > l1) {
- ogf_swap(l1 , l2 );
+ ogf_swap(l1, l2 );
ogf_swap(i_[1], i_[2]);
}
if (l1 > l0) {
- ogf_swap(l0 , l1 );
+ ogf_swap(l0, l1 );
ogf_swap(i_[0], i_[1]);
}
}