Cleanup: comments (long lines) in freestyle
This commit is contained in:
@@ -43,7 +43,7 @@ class AppView {
|
||||
virtual ~AppView();
|
||||
|
||||
public:
|
||||
//inherited
|
||||
// inherited
|
||||
inline unsigned int width()
|
||||
{
|
||||
return _width;
|
||||
@@ -246,7 +246,7 @@ class AppView {
|
||||
protected:
|
||||
float _Fovy;
|
||||
|
||||
//The root node container
|
||||
// The root node container
|
||||
NodeGroup _RootNode;
|
||||
NodeDrawingStyle *_ModelRootNode;
|
||||
NodeDrawingStyle *_SilhouetteRootNode;
|
||||
|
||||
@@ -179,7 +179,7 @@ Controller::~Controller()
|
||||
_ProgressBar = NULL;
|
||||
}
|
||||
|
||||
//delete _current_dirs;
|
||||
// delete _current_dirs;
|
||||
}
|
||||
|
||||
void Controller::setView(AppView *iView)
|
||||
@@ -300,7 +300,7 @@ int Controller::LoadMesh(Render *re, ViewLayer *view_layer, Depsgraph *depsgraph
|
||||
_RootNode->AddChild(new NodeViewLayer(*re->scene, *view_layer));
|
||||
|
||||
sceneHashFunc.reset();
|
||||
//blenderScene->accept(sceneHashFunc);
|
||||
// blenderScene->accept(sceneHashFunc);
|
||||
_RootNode->accept(sceneHashFunc);
|
||||
if (G.debug & G_DEBUG_FREESTYLE) {
|
||||
cout << "Scene hash : " << sceneHashFunc.toString() << endl;
|
||||
@@ -626,7 +626,7 @@ void Controller::ComputeViewMap()
|
||||
|
||||
void Controller::ComputeSteerableViewMap()
|
||||
{
|
||||
#if 0 //soc
|
||||
#if 0 // soc
|
||||
if ((!_Canvas) || (!_ViewMap))
|
||||
return;
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ class Controller {
|
||||
void setPassZ(float *buf, int width, int height);
|
||||
void setContext(bContext *C);
|
||||
|
||||
//soc
|
||||
// soc
|
||||
void init_options();
|
||||
|
||||
int LoadMesh(Render *re, ViewLayer *view_layer, Depsgraph *depsgraph);
|
||||
@@ -175,15 +175,15 @@ class Controller {
|
||||
|
||||
private:
|
||||
// Main Window:
|
||||
//AppMainWindow *_pMainWindow;
|
||||
// AppMainWindow *_pMainWindow;
|
||||
|
||||
// List of models currently loaded
|
||||
vector<string> _ListOfModels;
|
||||
|
||||
// Current directories
|
||||
//ConfigIO* _current_dirs;
|
||||
// ConfigIO* _current_dirs;
|
||||
|
||||
//View
|
||||
// View
|
||||
// 3D
|
||||
AppView *_pView;
|
||||
|
||||
@@ -195,7 +195,7 @@ class Controller {
|
||||
|
||||
RenderMonitor *_pRenderMonitor;
|
||||
|
||||
//Model
|
||||
// Model
|
||||
// Drawing Structure
|
||||
NodeGroup *_RootNode;
|
||||
|
||||
@@ -217,7 +217,7 @@ class Controller {
|
||||
#endif
|
||||
|
||||
// debug
|
||||
//NodeUser<ViewMap> *_ViewMapNode; // FIXME
|
||||
// NodeUser<ViewMap> *_ViewMapNode; // FIXME
|
||||
|
||||
// Chronometer:
|
||||
Chronometer _Chrono;
|
||||
@@ -229,7 +229,7 @@ class Controller {
|
||||
int _edgeTesselationNature;
|
||||
|
||||
FastGrid _Grid;
|
||||
//HashGrid _Grid;
|
||||
// HashGrid _Grid;
|
||||
|
||||
BBox<Vec3r> _Scene3dBBox;
|
||||
unsigned int _SceneNumFaces;
|
||||
@@ -241,9 +241,9 @@ class Controller {
|
||||
|
||||
int _render_count;
|
||||
|
||||
//AppStyleWindow *_pStyleWindow;
|
||||
//AppOptionsWindow *_pOptionsWindow;
|
||||
//AppDensityCurvesWindow *_pDensityCurvesWindow;
|
||||
// AppStyleWindow *_pStyleWindow;
|
||||
// AppOptionsWindow *_pOptionsWindow;
|
||||
// AppDensityCurvesWindow *_pDensityCurvesWindow;
|
||||
|
||||
ViewMapBuilder::visibility_algo _VisibilityAlgo;
|
||||
|
||||
|
||||
@@ -384,9 +384,10 @@ static void prepare(Render *re, ViewLayer *view_layer, Depsgraph *depsgraph)
|
||||
bool logical_and = ((lineset->flags & FREESTYLE_LINESET_FE_AND) != 0);
|
||||
// negation operator
|
||||
if (lineset->flags & FREESTYLE_LINESET_FE_NOT) {
|
||||
// convert an Exclusive condition into an Inclusive equivalent using De Morgan's laws:
|
||||
// NOT (X OR Y) --> (NOT X) AND (NOT Y)
|
||||
// NOT (X AND Y) --> (NOT X) OR (NOT Y)
|
||||
// convert an Exclusive condition into an
|
||||
// Inclusive equivalent using De Morgan's laws:
|
||||
// - NOT (X OR Y) --> (NOT X) AND (NOT Y)
|
||||
// - NOT (X AND Y) --> (NOT X) OR (NOT Y)
|
||||
for (int i = 0; i < num_edge_types; i++)
|
||||
conditions[i].value *= -1;
|
||||
logical_and = !logical_and;
|
||||
|
||||
@@ -28,7 +28,8 @@ namespace Freestyle {
|
||||
|
||||
/*! Class to define a regular grid used for ray casting computations
|
||||
* We don't use a hashtable here. The grid is explicitly stored for faster computations.
|
||||
* However, this might result in significant increase in memory usage (compared to the regular grid)
|
||||
* However, this might result in significant increase in memory usage
|
||||
* (compared to the regular grid).
|
||||
*/
|
||||
class FastGrid : public Grid {
|
||||
public:
|
||||
@@ -43,8 +44,9 @@ class FastGrid : public Grid {
|
||||
clear();
|
||||
}
|
||||
|
||||
/*! clears the grid
|
||||
* Deletes all the cells, clears the hashtable, resets size, size of cell, number of cells.
|
||||
/*!
|
||||
* clears the grid
|
||||
* Deletes all the cells, clears the hashtable, resets size, size of cell, number of cells.
|
||||
*/
|
||||
virtual void clear();
|
||||
|
||||
|
||||
@@ -181,8 +181,8 @@ static BezierCurve GenerateBezier(
|
||||
alpha_l = det_X_C1 / det_C0_C1;
|
||||
alpha_r = det_C0_X / det_C0_C1;
|
||||
|
||||
/* If alpha negative, use the Wu/Barsky heuristic (see text) (if alpha is 0, you get coincident control points
|
||||
* that lead to divide by zero in any subsequent NewtonRaphsonRootFind() call).
|
||||
/* If alpha negative, use the Wu/Barsky heuristic (see text) (if alpha is 0, you get coincident
|
||||
* control points that lead to divide by zero in any subsequent NewtonRaphsonRootFind() call).
|
||||
*/
|
||||
if (alpha_l < 1.0e-6 || alpha_r < 1.0e-6) {
|
||||
double dist = V2DistanceBetween2Points(&d[last], &d[first]) / 3.0;
|
||||
@@ -194,8 +194,9 @@ static BezierCurve GenerateBezier(
|
||||
return bezCurve;
|
||||
}
|
||||
|
||||
/* First and last control points of the Bezier curve are positioned exactly at the first and last data points
|
||||
* Control points 1 and 2 are positioned an alpha distance out on the tangent vectors, left and right, respectively
|
||||
/* First and last control points of the Bezier curve are positioned exactly at the first and last
|
||||
* data points Control points 1 and 2 are positioned an alpha distance out on the tangent
|
||||
* vectors, left and right, respectively
|
||||
*/
|
||||
bezCurve[0] = d[first];
|
||||
bezCurve[3] = d[last];
|
||||
|
||||
@@ -45,20 +45,24 @@ class GeomCleaner {
|
||||
|
||||
/*! Sorts an array of Indexed vertices
|
||||
* iVertices
|
||||
* Array of vertices to sort. It is organized as a float series of vertex coordinates: XYZXYZXYZ...
|
||||
* Array of vertices to sort.
|
||||
* It is organized as a float series of vertex coordinates: XYZXYZXYZ...
|
||||
* iVSize
|
||||
* The size of iVertices array.
|
||||
* iIndices
|
||||
* The array containing the vertex indices (used to refer to the vertex coordinates in an indexed face). Each
|
||||
* element is an unsignedeger multiple of 3.
|
||||
* The array containing the vertex indices
|
||||
* (used to refer to the vertex coordinates in an indexed face).
|
||||
* Each element is an unsignedeger multiple of 3.
|
||||
* iISize
|
||||
* The size of iIndices array
|
||||
* oVertices
|
||||
* Output of sorted vertices. A vertex v1 precedes another one v2 in this array if v1.x<v2.x,
|
||||
* or v1.x=v2.x && v1.y < v2.y or v1.x=v2.y && v1.y=v2.y && v1.z < v2.z.
|
||||
* Output of sorted vertices.
|
||||
* A vertex v1 precedes another one v2 in this array
|
||||
* if v1.x<v2.x, or v1.x=v2.x && v1.y < v2.y or v1.x=v2.y && v1.y=v2.y && v1.z < v2.z.
|
||||
* The array is organized as a 3-float serie giving the vertices coordinates: XYZXYZXYZ...
|
||||
* oIndices
|
||||
* Output corresponding to the iIndices array but reorganized in order to match the sorted vertex array.
|
||||
* Output corresponding to the iIndices array but reorganized in
|
||||
* order to match the sorted vertex array.
|
||||
*/
|
||||
static void SortIndexedVertexArray(const float *iVertices,
|
||||
unsigned iVSize,
|
||||
@@ -67,13 +71,16 @@ class GeomCleaner {
|
||||
float **oVertices,
|
||||
unsigned **oIndices);
|
||||
|
||||
/*! Compress a SORTED indexed vertex array by eliminating multiple appearing occurences of a single vertex.
|
||||
/*! Compress a SORTED indexed vertex array by eliminating multiple
|
||||
* appearing occurences of a single vertex.
|
||||
* iVertices
|
||||
* The SORTED vertex array to compress. It is organized as a float series of vertex coordinates: XYZXYZXYZ...
|
||||
* The SORTED vertex array to compress.
|
||||
* It is organized as a float series of vertex coordinates: XYZXYZXYZ...
|
||||
* iVSize
|
||||
* The size of iVertices array.
|
||||
* iIndices
|
||||
* The array containing the vertex indices (used to refer to the vertex coordinates in an indexed face).
|
||||
* The array containing the vertex indices
|
||||
* (used to refer to the vertex coordinates in an indexed face).
|
||||
* Each element is an unsignedeger multiple of 3.
|
||||
* iISize
|
||||
* The size of iIndices array
|
||||
@@ -100,7 +107,8 @@ class GeomCleaner {
|
||||
* iVSize
|
||||
* The size of iVertices array.
|
||||
* iIndices
|
||||
* The array containing the vertex indices (used to refer to the vertex coordinates in an indexed face).
|
||||
* The array containing the vertex indices
|
||||
* (used to refer to the vertex coordinates in an indexed face).
|
||||
* Each element is an unsignedeger multiple of 3.
|
||||
* iISize
|
||||
* The size of iIndices array
|
||||
@@ -120,15 +128,16 @@ class GeomCleaner {
|
||||
unsigned *oVSize,
|
||||
unsigned **oIndices);
|
||||
|
||||
/*! Cleans an indexed vertex array. (Identical to SortAndCompress except that we use here a hash table
|
||||
* to create the new array.)
|
||||
/*! Cleans an indexed vertex array.
|
||||
* (Identical to SortAndCompress except that we use here a hash table to create the new array.)
|
||||
* iVertices
|
||||
* The vertex array to sort then compress. It is organized as a float series of
|
||||
* vertex coordinates: XYZXYZXYZ...
|
||||
* iVSize
|
||||
* The size of iVertices array.
|
||||
* iIndices
|
||||
* The array containing the vertex indices (used to refer to the vertex coordinates in an indexed face).
|
||||
* The array containing the vertex indices
|
||||
* (used to refer to the vertex coordinates in an indexed face).
|
||||
* Each element is an unsignedeger multiple of 3.
|
||||
* iISize
|
||||
* The size of iIndices array
|
||||
@@ -154,9 +163,10 @@ class GeomCleaner {
|
||||
};
|
||||
|
||||
/*! Binary operators */
|
||||
//inline bool operator<(const IndexedVertex& iv1, const IndexedVertex& iv2);
|
||||
// inline bool operator<(const IndexedVertex& iv1, const IndexedVertex& iv2);
|
||||
|
||||
/*! Class Indexed Vertex. Used to represent an indexed vertex by storing the vertex coordinates as well as its index */
|
||||
/*! Class Indexed Vertex. Used to represent an indexed vertex by storing the vertex coordinates as
|
||||
* well as its index */
|
||||
class IndexedVertex {
|
||||
private:
|
||||
Vec3f _Vector;
|
||||
@@ -223,7 +233,7 @@ class IndexedVertex {
|
||||
return _Vector[i];
|
||||
}
|
||||
|
||||
//friend inline bool operator<(const IndexedVertex& iv1, const IndexedVertex& iv2);
|
||||
// friend inline bool operator<(const IndexedVertex& iv1, const IndexedVertex& iv2);
|
||||
inline bool operator<(const IndexedVertex &v) const
|
||||
{
|
||||
return (_Vector < v._Vector);
|
||||
|
||||
@@ -88,8 +88,8 @@ intersection_test intersect2dSeg2dSeg(
|
||||
r1 = a2 * p1[0] + b2 * p1[1] + c2;
|
||||
r2 = a2 * p2[0] + b2 * p2[1] + c2;
|
||||
|
||||
// Check signs of r1 and r2. If both point 1 and point 2 lie on same side of second line segment,
|
||||
// the line segments do not intersect.
|
||||
// Check signs of r1 and r2. If both point 1 and point 2 lie on same side of second line
|
||||
// segment, the line segments do not intersect.
|
||||
if (r1 != 0 && r2 != 0 && r1 * r2 > 0.0)
|
||||
return (DONT_INTERSECT);
|
||||
|
||||
@@ -172,8 +172,8 @@ intersection_test intersect2dSeg2dSegParametric(const Vec2r &p1,
|
||||
r1 = a2 * p1[0] + b2 * p1[1] + c2;
|
||||
r2 = a2 * p2[0] + b2 * p2[1] + c2;
|
||||
|
||||
// Check signs of r1 and r2. If both point 1 and point 2 lie on same side of second line segment,
|
||||
// the line segments do not intersect.
|
||||
// Check signs of r1 and r2. If both point 1 and point 2 lie on same side of second line
|
||||
// segment, the line segments do not intersect.
|
||||
if (r1 != 0 && r2 != 0 && r1 * r2 > 0.0)
|
||||
return (DONT_INTERSECT);
|
||||
|
||||
@@ -202,8 +202,8 @@ intersection_test intersect2dSeg2dSegParametric(const Vec2r &p1,
|
||||
// 2001-03-05: released the code in its first version
|
||||
// 2001-06-18: changed the order of the tests, faster
|
||||
//
|
||||
// Acknowledgement: Many thanks to Pierre Terdiman for suggestions and discussions on how to optimize code.
|
||||
// Thanks to David Hunt for finding a ">="-bug!
|
||||
// Acknowledgement: Many thanks to Pierre Terdiman for suggestions and discussions on how to
|
||||
// optimize code. Thanks to David Hunt for finding a ">="-bug!
|
||||
|
||||
#define X 0
|
||||
#define Y 1
|
||||
@@ -337,10 +337,10 @@ intersection_test intersect2dSeg2dSegParametric(const Vec2r &p1,
|
||||
// This internal procedure is defined below.
|
||||
bool overlapPlaneBox(Vec3r &normal, real d, Vec3r &maxbox);
|
||||
|
||||
// Use separating axis theorem to test overlap between triangle and box need to test for overlap in these directions:
|
||||
// 1) the {x,y,z}-directions (actually, since we use the AABB of the triangle we do not even need to test these)
|
||||
// 2) normal of the triangle
|
||||
// 3) crossproduct(edge from tri, {x,y,z}-directin) this gives 3x3=9 more tests
|
||||
// Use separating axis theorem to test overlap between triangle and box need to test for overlap in
|
||||
// these directions: 1) the {x,y,z}-directions (actually, since we use the AABB of the triangle we
|
||||
// do not even need to test these) 2) normal of the triangle 3) crossproduct(edge from tri,
|
||||
// {x,y,z}-directin) this gives 3x3=9 more tests
|
||||
bool overlapTriangleBox(Vec3r &boxcenter, Vec3r &boxhalfsize, Vec3r triverts[3])
|
||||
{
|
||||
Vec3r v0, v1, v2, normal, e0, e1, e2;
|
||||
@@ -382,8 +382,8 @@ bool overlapTriangleBox(Vec3r &boxcenter, Vec3r &boxhalfsize, Vec3r triverts[3])
|
||||
|
||||
// Bullet 1:
|
||||
// first test overlap in the {x,y,z}-directions
|
||||
// find min, max of the triangle each direction, and test for overlap in that direction -- this is equivalent
|
||||
// to testing a minimal AABB around the triangle against the AABB
|
||||
// find min, max of the triangle each direction, and test for overlap in that direction -- this
|
||||
// is equivalent to testing a minimal AABB around the triangle against the AABB
|
||||
|
||||
// test in X-direction
|
||||
FINDMINMAX(v0[X], v1[X], v2[X], min, max);
|
||||
@@ -664,7 +664,7 @@ void fromWorldToImage(const Vec3r &p, Vec3r &q, const real transform[4][4], cons
|
||||
// winX:
|
||||
q[0] = viewport[0] + viewport[2] * (q[0] + 1.0) / 2.0;
|
||||
|
||||
//winY:
|
||||
// winY:
|
||||
q[1] = viewport[1] + viewport[3] * (q[1] + 1.0) / 2.0;
|
||||
}
|
||||
|
||||
@@ -709,10 +709,10 @@ void fromCameraToWorld(const Vec3r &p, Vec3r &q, const real model_view_matrix[4]
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Copyright 2001, softSurfer (www.softsurfer.com)
|
||||
// This code may be freely used and modified for any purpose providing that this copyright notice is included with it.
|
||||
// SoftSurfer makes no warranty for this code, and cannot be held liable for any real or imagined damage resulting
|
||||
// from its use.
|
||||
// Users of this code must verify correctness for their application.
|
||||
// This code may be freely used and modified for any purpose providing that this copyright notice
|
||||
// is included with it. SoftSurfer makes no warranty for this code, and cannot be held liable for
|
||||
// any real or imagined damage resulting from its use. Users of this code must verify correctness
|
||||
// for their application.
|
||||
|
||||
#define PERP(u, v) ((u)[0] * (v)[1] - (u)[1] * (v)[0]) // 2D perp product
|
||||
|
||||
|
||||
@@ -105,7 +105,8 @@ bool include2dSeg2dArea(const Vec2r &min, const Vec2r &max, const Vec2r &A, cons
|
||||
/*! Box-triangle overlap test, adapted from Tomas Akenine-Möller code */
|
||||
bool overlapTriangleBox(Vec3r &boxcenter, Vec3r &boxhalfsize, Vec3r triverts[3]);
|
||||
|
||||
/*! Fast, Minimum Storage Ray-Triangle Intersection, adapted from Tomas Möller and Ben Trumbore code. */
|
||||
/*! Fast, Minimum Storage Ray-Triangle Intersection, adapted from Tomas Möller and Ben Trumbore
|
||||
* code. */
|
||||
bool intersectRayTriangle(const Vec3r &orig,
|
||||
const Vec3r &dir,
|
||||
const Vec3r &v0,
|
||||
@@ -126,7 +127,8 @@ intersection_test intersectRayPlane(const Vec3r &orig,
|
||||
const real epsilon = M_EPSILON); // the epsilon to use
|
||||
|
||||
/*! Intersection Ray-Bounding box (axis aligned).
|
||||
* Adapted from Williams et al, "An Efficient Robust Ray-Box Intersection Algorithm", JGT 10:1 (2005), pp. 49-54.
|
||||
* Adapted from Williams et al, "An Efficient Robust Ray-Box Intersection Algorithm", JGT 10:1
|
||||
* (2005), pp. 49-54.
|
||||
*/
|
||||
bool intersectRayBBox(const Vec3r &orig,
|
||||
const Vec3r &dir, // ray origin and direction
|
||||
|
||||
@@ -49,10 +49,10 @@ void firstIntersectionGridVisitor::examineOccluder(Polygon3r *occ)
|
||||
{
|
||||
// check whether the edge and the polygon plane are coincident:
|
||||
//-------------------------------------------------------------
|
||||
//first let us compute the plane equation.
|
||||
// first let us compute the plane equation.
|
||||
Vec3r v1(((occ)->getVertices())[0]);
|
||||
Vec3d normal((occ)->getNormal());
|
||||
//soc unused - double d = -(v1 * normal);
|
||||
// soc unused - double d = -(v1 * normal);
|
||||
|
||||
double tmp_u, tmp_v, tmp_t;
|
||||
if ((occ)->rayIntersect(ray_org_, ray_dir_, tmp_t, tmp_u, tmp_v)) {
|
||||
@@ -167,8 +167,9 @@ void Grid::insertOccluder(Polygon3r *occluder)
|
||||
getCellCoordinates(min, imin);
|
||||
|
||||
// We are now going to fill in the cells overlapping with the polygon bbox.
|
||||
// If the polygon is a triangle (most of cases), we also check for each of these cells if it is overlapping with
|
||||
// the triangle in order to only fill in the ones really overlapping the triangle.
|
||||
// If the polygon is a triangle (most of cases), we also check for each of these cells if it is
|
||||
// overlapping with the triangle in order to only fill in the ones really overlapping the
|
||||
// triangle.
|
||||
|
||||
unsigned i, x, y, z;
|
||||
vector<Vec3r>::const_iterator it;
|
||||
@@ -239,8 +240,8 @@ bool Grid::nextRayCell(Vec3u ¤t_cell, Vec3u &next_cell)
|
||||
t_min = FLT_MAX; // init tmin with handle of the case where one or 2 _u[i] = 0.
|
||||
unsigned coord = 0; // predominant coord(0=x, 1=y, 2=z)
|
||||
|
||||
// using a parametric equation of a line : B = A + t u, we find the tx, ty and tz respectively coresponding
|
||||
// to the intersections with the plans:
|
||||
// using a parametric equation of a line : B = A + t u, we find the tx, ty and tz respectively
|
||||
// coresponding to the intersections with the plans:
|
||||
// x = _cell_size[0], y = _cell_size[1], z = _cell_size[2]
|
||||
for (i = 0; i < 3; i++) {
|
||||
if (_ray_dir[i] == 0)
|
||||
@@ -318,8 +319,8 @@ Polygon3r *Grid::castRayToFindFirstIntersection(
|
||||
firstIntersectionGridVisitor visitor(orig, dir, _cell_size);
|
||||
castRayInternal(visitor);
|
||||
// ARB: This doesn't work, because occluders are unordered within any cell
|
||||
// visitor.occluder() will be an occluder, but we have no guarantee it will be the *first* occluder.
|
||||
// I assume that is the reason this code is not actually used for FindOccludee.
|
||||
// visitor.occluder() will be an occluder, but we have no guarantee it will be the *first*
|
||||
// occluder. I assume that is the reason this code is not actually used for FindOccludee.
|
||||
occluder = visitor.occluder();
|
||||
t = visitor.t_;
|
||||
u = visitor.u_;
|
||||
@@ -337,7 +338,7 @@ void Grid::initRay(const Vec3r &orig, const Vec3r &end, unsigned timestamp)
|
||||
|
||||
for (unsigned i = 0; i < 3; i++) {
|
||||
_current_cell[i] = (unsigned)floor((orig[i] - _orig[i]) / _cell_size[i]);
|
||||
//soc unused - unsigned u = _current_cell[i];
|
||||
// soc unused - unsigned u = _current_cell[i];
|
||||
_pt[i] = orig[i] - _orig[i] - _current_cell[i] * _cell_size[i];
|
||||
}
|
||||
//_ray_occluders.clear();
|
||||
@@ -358,7 +359,7 @@ bool Grid::initInfiniteRay(const Vec3r &orig, const Vec3r &dir, unsigned timesta
|
||||
if (box.inside(orig)) {
|
||||
for (unsigned int i = 0; i < 3; i++) {
|
||||
_current_cell[i] = (unsigned int)floor((orig[i] - _orig[i]) / _cell_size[i]);
|
||||
//soc unused - unsigned u = _current_cell[i];
|
||||
// soc unused - unsigned u = _current_cell[i];
|
||||
_pt[i] = orig[i] - _orig[i] - _current_cell[i] * _cell_size[i];
|
||||
}
|
||||
}
|
||||
@@ -372,7 +373,7 @@ bool Grid::initInfiniteRay(const Vec3r &orig, const Vec3r &dir, unsigned timesta
|
||||
_current_cell[i] = (unsigned)floor((newOrig[i] - _orig[i]) / _cell_size[i]);
|
||||
if (_current_cell[i] == _cells_nb[i])
|
||||
_current_cell[i] = _cells_nb[i] - 1;
|
||||
//soc unused - unsigned u = _current_cell[i];
|
||||
// soc unused - unsigned u = _current_cell[i];
|
||||
_pt[i] = newOrig[i] - _orig[i] - _current_cell[i] * _cell_size[i];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ class Cell {
|
||||
|
||||
class GridVisitor {
|
||||
public:
|
||||
virtual ~GridVisitor(){}; //soc
|
||||
virtual ~GridVisitor(){}; // soc
|
||||
|
||||
virtual void discoverCell(Cell * /*cell*/)
|
||||
{
|
||||
@@ -143,7 +143,7 @@ class allOccludersGridVisitor : public GridVisitor {
|
||||
* The occluder and the intersection information are stored and accessible.
|
||||
*/
|
||||
class firstIntersectionGridVisitor : public GridVisitor {
|
||||
//soc - changed order to remove warnings
|
||||
// soc - changed order to remove warnings
|
||||
public:
|
||||
double u_, v_, t_;
|
||||
|
||||
@@ -217,7 +217,8 @@ class Grid {
|
||||
*/
|
||||
virtual void configure(const Vec3r &orig, const Vec3r &size, unsigned nb);
|
||||
|
||||
/*! returns a vector of integer containing the coordinates of the cell containing the point passed as argument
|
||||
/*! returns a vector of integer containing the coordinates of the cell containing the point
|
||||
* passed as argument
|
||||
* p
|
||||
* The point for which we're looking the cell
|
||||
*/
|
||||
@@ -241,8 +242,8 @@ class Grid {
|
||||
/*! returns the cell whose coordinates are pased as argument */
|
||||
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
|
||||
/*! 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
|
||||
*/
|
||||
@@ -253,7 +254,8 @@ class Grid {
|
||||
return getCell(coord);
|
||||
}
|
||||
|
||||
/*! Retrieves the x,y,z coordinates of the origin of the cell whose coordinates (i,j,k) is passed as argument
|
||||
/*! Retrieves the x,y,z coordinates of the origin of the cell whose coordinates (i,j,k)
|
||||
* is passed as argument:
|
||||
* cell_coord
|
||||
* i,j,k integer coordinates for the cell
|
||||
* orig
|
||||
@@ -265,7 +267,7 @@ class Grid {
|
||||
orig[i] = _orig[i] + cell_coord[i] * _cell_size[i];
|
||||
}
|
||||
|
||||
/*! Retrieves the box corresponding to the cell whose coordinates are passed as argument.
|
||||
/*! Retrieves the box corresponding to the cell whose coordinates are passed as argument:
|
||||
* cell_coord
|
||||
* i,j,k integer coordinates for the cell
|
||||
* min_out
|
||||
@@ -280,9 +282,8 @@ class Grid {
|
||||
}
|
||||
|
||||
/*! inserts a convex polygon occluder
|
||||
* This method is quite coarse insofar as it adds all cells intersecting the polygon bounding box
|
||||
* convex_poly
|
||||
* The list of 3D points constituting a convex polygon
|
||||
* This method is quite coarse insofar as it adds all cells intersecting the polygon bounding
|
||||
* box convex_poly The list of 3D points constituting a convex polygon
|
||||
*/
|
||||
void insertOccluder(Polygon3r *convex_poly);
|
||||
|
||||
@@ -301,8 +302,8 @@ class Grid {
|
||||
// Prepares to cast ray without generating OccludersSet
|
||||
void initAcceleratedRay(const Vec3r &orig, const Vec3r &end, unsigned timestamp);
|
||||
|
||||
/*! Casts an infinite ray (still finishing at the end of the grid) from a starting point and in a given direction.
|
||||
* Returns the list of occluders contained in the cells intersected by this ray
|
||||
/*! Casts an infinite ray (still finishing at the end of the grid) from a starting point and in a
|
||||
* given direction. Returns the list of occluders contained in the cells intersected by this ray
|
||||
* Starts with a call to InitRay.
|
||||
*/
|
||||
void castInfiniteRay(const Vec3r &orig,
|
||||
@@ -313,9 +314,9 @@ class Grid {
|
||||
// Prepares to cast ray without generating OccludersSet.
|
||||
bool initAcceleratedInfiniteRay(const Vec3r &orig, const Vec3r &dir, unsigned timestamp);
|
||||
|
||||
/*! Casts an infinite ray (still finishing at the end of the grid) from a starting point and in a given direction.
|
||||
* Returns the first intersection (occluder,t,u,v) or null.
|
||||
* Starts with a call to InitRay.
|
||||
/*! Casts an infinite ray (still finishing at the end of the grid) from a starting point and in a
|
||||
* given direction. Returns the first intersection (occluder,t,u,v) or null. Starts with a call
|
||||
* to InitRay.
|
||||
*/
|
||||
Polygon3r *castRayToFindFirstIntersection(
|
||||
const Vec3r &orig, const Vec3r &dir, double &t, double &u, double &v, unsigned timestamp);
|
||||
@@ -344,7 +345,7 @@ class Grid {
|
||||
return _cell_size;
|
||||
}
|
||||
|
||||
//ARB profiling only:
|
||||
// ARB profiling only:
|
||||
inline OccludersSet *getOccluders()
|
||||
{
|
||||
return &_occluders;
|
||||
@@ -392,12 +393,13 @@ class Grid {
|
||||
|
||||
Vec3r _ray_dir; // direction vector for the ray
|
||||
Vec3u _current_cell; // The current cell being processed (designated by its 3 coordinates)
|
||||
Vec3r
|
||||
_pt; // Points corresponding to the incoming and outgoing intersections of one cell with the ray
|
||||
Vec3r _pt; // Points corresponding to the incoming and outgoing intersections of one cell with
|
||||
// the ray
|
||||
real _t_end; // To know when we are at the end of the ray
|
||||
real _t;
|
||||
|
||||
//OccludersSet _ray_occluders; // Set storing the occluders contained in the cells traversed by a ray
|
||||
// OccludersSet _ray_occluders; // Set storing the occluders contained in the cells traversed by
|
||||
// a ray
|
||||
OccludersSet _occluders; // List of all occluders inserted in the grid
|
||||
|
||||
#ifdef WITH_CXX_GUARDEDALLOC
|
||||
|
||||
@@ -26,14 +26,15 @@ namespace Freestyle {
|
||||
void GridHelpers::getDefaultViewProscenium(real viewProscenium[4])
|
||||
{
|
||||
// Get proscenium boundary for culling
|
||||
// bufferZone determines the amount by which the area processed should exceed the actual image area.
|
||||
// This is intended to avoid visible artifacts generated along the proscenium edge.
|
||||
// Perhaps this is no longer needed now that entire view edges are culled at once, since that theoretically
|
||||
// should eliminate visible artifacts.
|
||||
// To the extent it is still useful, bufferZone should be put into the UI as configurable percentage value
|
||||
// bufferZone determines the amount by which the area processed should exceed the actual image
|
||||
// area. This is intended to avoid visible artifacts generated along the proscenium edge. Perhaps
|
||||
// this is no longer needed now that entire view edges are culled at once, since that
|
||||
// theoretically should eliminate visible artifacts. To the extent it is still useful, bufferZone
|
||||
// should be put into the UI as configurable percentage value
|
||||
const real bufferZone = 0.05;
|
||||
// borderZone describes a blank border outside the proscenium, but still inside the image area.
|
||||
// Only intended for exposing possible artifacts along or outside the proscenium edge during debugging.
|
||||
// Only intended for exposing possible artifacts along or outside the proscenium edge during
|
||||
// debugging.
|
||||
const real borderZone = 0.0;
|
||||
viewProscenium[0] = g_freestyle.viewport[2] * (borderZone - bufferZone);
|
||||
viewProscenium[1] = g_freestyle.viewport[2] * (1.0f - borderZone + bufferZone);
|
||||
|
||||
@@ -126,8 +126,8 @@ class Transform {
|
||||
|
||||
inline bool insideProscenium(const real proscenium[4], const Polygon3r &polygon)
|
||||
{
|
||||
// N.B. The bounding box check is redundant for inserting occluders into cells, because the cell selection code
|
||||
// in insertOccluders has already guaranteed that the bounding boxes will overlap.
|
||||
// N.B. The bounding box check is redundant for inserting occluders into cells, because the cell
|
||||
// selection code in insertOccluders has already guaranteed that the bounding boxes will overlap.
|
||||
// First check the viewport edges, since they are the easiest case
|
||||
// Check if the bounding box is entirely outside the proscenium
|
||||
Vec3r bbMin, bbMax;
|
||||
|
||||
@@ -188,8 +188,8 @@ template<class T, class Point> class Segment {
|
||||
# pragma warning(pop)
|
||||
#endif
|
||||
|
||||
/*! defines a binary function that can be overload by the user to specify at each condition the intersection
|
||||
* between 2 edges must be computed
|
||||
/*! defines a binary function that can be overload by the user to specify at each condition the
|
||||
* intersection between 2 edges must be computed
|
||||
*/
|
||||
template<class T1, class T2> struct binary_rule {
|
||||
binary_rule()
|
||||
|
||||
@@ -46,7 +46,8 @@ class GaussianFilter {
|
||||
float _sigma;
|
||||
float *_mask;
|
||||
int _bound;
|
||||
// the real mask size (must be odd)(the size of the mask we store is ((_maskSize+1)/2)*((_maskSize+1)/2))
|
||||
// the real mask size (must be odd)(the size of the mask we store is
|
||||
// ((_maskSize+1)/2)*((_maskSize+1)/2))
|
||||
int _maskSize;
|
||||
int _storedMaskSize; // (_maskSize+1)/2)
|
||||
|
||||
@@ -56,13 +57,13 @@ class GaussianFilter {
|
||||
GaussianFilter &operator=(const GaussianFilter &);
|
||||
virtual ~GaussianFilter();
|
||||
|
||||
/*! Returns the value for pixel x,y of image "map" after a gaussian blur, made using the sigma value.
|
||||
* The sigma value determines the mask size (~ 2 x sigma).
|
||||
* \param map:
|
||||
* The image we wish to work on. The Map template must implement the following methods:
|
||||
* - float pixel(unsigned int x,unsigned int y) const;
|
||||
* - unsigned width() const;
|
||||
* - unsigned height() const;
|
||||
/*! Returns the value for pixel x,y of image "map" after a gaussian blur, made using the sigma
|
||||
* value. The sigma value determines the mask size (~ 2 x sigma).
|
||||
* \param map: The image we wish to work on.
|
||||
* The Map template must implement the following methods:
|
||||
* - float pixel(unsigned int x,unsigned int y) const;
|
||||
* - unsigned width() const;
|
||||
* - unsigned height() const;
|
||||
* \param x:
|
||||
* The abscissa of the pixel where we want to evaluate the gaussian blur.
|
||||
* \param y:
|
||||
@@ -127,8 +128,8 @@ template<class Map> float GaussianFilter::getSmoothedPixel(Map *map, int x, int
|
||||
{
|
||||
float sum = 0.0f;
|
||||
float L = 0.0f;
|
||||
int w = (int)map->width(); //soc
|
||||
int h = (int)map->height(); //soc
|
||||
int w = (int)map->width(); // soc
|
||||
int h = (int)map->height(); // soc
|
||||
|
||||
// Current pixel is x,y
|
||||
// Sum surrounding pixels L value:
|
||||
@@ -145,7 +146,7 @@ template<class Map> float GaussianFilter::getSmoothedPixel(Map *map, int x, int
|
||||
sum += m;
|
||||
}
|
||||
}
|
||||
//L /= sum;
|
||||
// L /= sum;
|
||||
return L;
|
||||
}
|
||||
|
||||
|
||||
@@ -35,9 +35,10 @@ namespace Freestyle {
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/*! This class allows the storing of part of an image, while allowing a normal access to its pixel values.
|
||||
* You can for example only a rectangle of sw*sh, whose lower-left corner is at (ox, oy), of an image of
|
||||
* size w*h, and access these pixels using x,y coordinates specified in the whole image coordinate system.
|
||||
/*! This class allows the storing of part of an image, while allowing a normal access to its pixel
|
||||
* values. You can for example only a rectangle of sw*sh, whose lower-left corner is at (ox, oy),
|
||||
* of an image of size w*h, and access these pixels using x,y coordinates specified in the whole
|
||||
* image coordinate system.
|
||||
*/
|
||||
class FrsImage {
|
||||
public:
|
||||
@@ -209,7 +210,8 @@ class RGBImage : public FrsImage {
|
||||
/*! Builds an RGB partial image from the useful part buffer.
|
||||
* \param rgb:
|
||||
* The array of size 3*sw*sh containing the RGB values of the sw*sh pixels we need to stored.
|
||||
* These sw*sh pixels constitute a rectangular part of a bigger RGB image containing w*h pixels.
|
||||
* These sw*sh pixels constitute a rectangular part of a bigger
|
||||
* RGB image containing w*h pixels.
|
||||
* \param w:
|
||||
* The width of the complete image
|
||||
* \param h:
|
||||
@@ -346,7 +348,8 @@ class GrayImage : public FrsImage {
|
||||
/*! Builds a partial image from the useful part buffer.
|
||||
* \param lvl:
|
||||
* The array of size sw*sh containing the gray values of the sw*sh pixels we need to stored.
|
||||
* These sw*sh pixels constitute a rectangular part of a bigger gray image containing w*h pixels.
|
||||
* These sw*sh pixels constitute a rectangular part of a bigger
|
||||
* gray image containing w*h pixels.
|
||||
* \param w:
|
||||
* The width of the complete image
|
||||
* \param h:
|
||||
|
||||
@@ -153,7 +153,7 @@ void GaussianPyramid::BuildPyramid(GrayImage *level0, unsigned nbLevels)
|
||||
unsigned w = pLevel->width();
|
||||
unsigned h = pLevel->height();
|
||||
if (nbLevels != 0) {
|
||||
for (unsigned int i = 0; i < nbLevels; ++i) { //soc
|
||||
for (unsigned int i = 0; i < nbLevels; ++i) { // soc
|
||||
w = pLevel->width() >> 1;
|
||||
h = pLevel->height() >> 1;
|
||||
GrayImage *img = new GrayImage(w, h);
|
||||
|
||||
@@ -43,7 +43,7 @@ class ImagePyramid {
|
||||
{
|
||||
}
|
||||
ImagePyramid(const ImagePyramid &iBrother);
|
||||
//ImagePyramid(const GrayImage& level0, unsigned nbLevels);
|
||||
// ImagePyramid(const GrayImage& level0, unsigned nbLevels);
|
||||
virtual ~ImagePyramid();
|
||||
|
||||
/*! Builds the pyramid.
|
||||
|
||||
@@ -31,7 +31,7 @@ extern "C" {
|
||||
|
||||
//------------------------INSTANCE METHODS ----------------------------------
|
||||
|
||||
//ViewMapGradientNormBP1D(int level, IntegrationType iType=MEAN, float sampling=2.0)
|
||||
// ViewMapGradientNormBP1D(int level, IntegrationType iType=MEAN, float sampling=2.0)
|
||||
|
||||
static char ViewMapGradientNormBP1D___doc__[] =
|
||||
"Class hierarchy: :class:`freestyle.types.BinaryPredicate1D` > "
|
||||
@@ -82,7 +82,7 @@ static int ViewMapGradientNormBP1D___init__(BPy_ViewMapGradientNormBP1D *self,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*-----------------------BPy_ViewMapGradientNormBP1D type definition ------------------------------*/
|
||||
/*-----------------------BPy_ViewMapGradientNormBP1D type definition ----------------------------*/
|
||||
|
||||
PyTypeObject ViewMapGradientNormBP1D_Type = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0) "ViewMapGradientNormBP1D", /* tp_name */
|
||||
|
||||
@@ -136,7 +136,7 @@ static int CurvePoint_init(BPy_CurvePoint *self, PyObject *args, PyObject *kwds)
|
||||
return 0;
|
||||
}
|
||||
|
||||
///bool operator== (const CurvePoint &b)
|
||||
/// bool operator== (const CurvePoint &b)
|
||||
|
||||
/*----------------------CurvePoint get/setters ----------------------------*/
|
||||
|
||||
|
||||
@@ -161,7 +161,7 @@ static void ChainPredicateIterator_dealloc(BPy_ChainPredicateIterator *self)
|
||||
ChainingIterator_Type.tp_dealloc((PyObject *)self);
|
||||
}
|
||||
|
||||
/*-----------------------BPy_ChainPredicateIterator type definition ------------------------------*/
|
||||
/*-----------------------BPy_ChainPredicateIterator type definition ----------------------------*/
|
||||
|
||||
PyTypeObject ChainPredicateIterator_Type = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0) "ChainPredicateIterator", /* tp_name */
|
||||
|
||||
@@ -31,8 +31,8 @@ extern "C" {
|
||||
|
||||
//------------------------INSTANCE METHODS ----------------------------------
|
||||
|
||||
// ChainSilhouetteIterator (bool restrict_to_selection=true, ViewEdge *begin=NULL, bool orientation=true)
|
||||
// ChainSilhouetteIterator (const ChainSilhouetteIterator &brother)
|
||||
// ChainSilhouetteIterator (bool restrict_to_selection=true, ViewEdge *begin=NULL, bool
|
||||
// orientation=true) ChainSilhouetteIterator (const ChainSilhouetteIterator &brother)
|
||||
|
||||
PyDoc_STRVAR(ChainSilhouetteIterator_doc,
|
||||
"Class hierarchy: :class:`freestyle.types.Iterator` >\n"
|
||||
@@ -117,7 +117,7 @@ static int ChainSilhouetteIterator_init(BPy_ChainSilhouetteIterator *self,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*-----------------------BPy_ChainSilhouetteIterator type definition ------------------------------*/
|
||||
/*-----------------------BPy_ChainSilhouetteIterator type definition ----------------------------*/
|
||||
|
||||
PyTypeObject ChainSilhouetteIterator_Type = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0) "ChainSilhouetteIterator", /* tp_name */
|
||||
|
||||
@@ -137,7 +137,7 @@ static PyGetSetDef BPy_orientedViewEdgeIterator_getseters[] = {
|
||||
{NULL, NULL, NULL, NULL, NULL} /* Sentinel */
|
||||
};
|
||||
|
||||
/*-----------------------BPy_orientedViewEdgeIterator type definition ------------------------------*/
|
||||
/*-----------------------BPy_orientedViewEdgeIterator type definition ---------------------------*/
|
||||
|
||||
PyTypeObject orientedViewEdgeIterator_Type = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0) "orientedViewEdgeIterator", /* tp_name */
|
||||
|
||||
@@ -63,7 +63,7 @@ static int BackboneStretcherShader___init__(BPy_BackboneStretcherShader *self,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*-----------------------BPy_BackboneStretcherShader type definition ------------------------------*/
|
||||
/*-----------------------BPy_BackboneStretcherShader type definition ----------------------------*/
|
||||
|
||||
PyTypeObject BackboneStretcherShader_Type = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0) "BackboneStretcherShader", /* tp_name */
|
||||
|
||||
@@ -31,7 +31,8 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject CalligraphicShader_Type;
|
||||
|
||||
#define BPy_CalligraphicShader_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&CalligraphicShader_Type)
|
||||
#define BPy_CalligraphicShader_Check(v) \
|
||||
(PyObject_IsInstance((PyObject *)v, (PyObject *)&CalligraphicShader_Type)
|
||||
|
||||
/*---------------------------Python BPy_CalligraphicShader structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -62,7 +62,7 @@ static int ConstantThicknessShader___init__(BPy_ConstantThicknessShader *self,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*-----------------------BPy_ConstantThicknessShader type definition ------------------------------*/
|
||||
/*-----------------------BPy_ConstantThicknessShader type definition ----------------------------*/
|
||||
|
||||
PyTypeObject ConstantThicknessShader_Type = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0) "ConstantThicknessShader", /* tp_name */
|
||||
|
||||
@@ -68,7 +68,7 @@ static int ConstrainedIncreasingThicknessShader___init__(
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*-----------------------BPy_ConstrainedIncreasingThicknessShader type definition ------------------------------*/
|
||||
/*-----------------------BPy_ConstrainedIncreasingThicknessShader type definition ---------------*/
|
||||
|
||||
PyTypeObject ConstrainedIncreasingThicknessShader_Type = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0) "ConstrainedIncreasingThicknessShader", /* tp_name */
|
||||
|
||||
@@ -34,7 +34,8 @@ extern PyTypeObject ConstrainedIncreasingThicknessShader_Type;
|
||||
#define BPy_ConstrainedIncreasingThicknessShader_Check(v) \
|
||||
(PyObject_IsInstance((PyObject *)v, (PyObject *)&ConstrainedIncreasingThicknessShader_Type))
|
||||
|
||||
/*---------------------------Python BPy_ConstrainedIncreasingThicknessShader structure definition----------*/
|
||||
/*---------------------------Python BPy_ConstrainedIncreasingThicknessShader structure
|
||||
* definition----------*/
|
||||
typedef struct {
|
||||
BPy_StrokeShader py_ss;
|
||||
} BPy_ConstrainedIncreasingThicknessShader;
|
||||
|
||||
@@ -68,7 +68,7 @@ static int IncreasingThicknessShader___init__(BPy_IncreasingThicknessShader *sel
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*-----------------------BPy_IncreasingThicknessShader type definition ------------------------------*/
|
||||
/*-----------------------BPy_IncreasingThicknessShader type definition --------------------------*/
|
||||
|
||||
PyTypeObject IncreasingThicknessShader_Type = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0) "IncreasingThicknessShader", /* tp_name */
|
||||
|
||||
@@ -69,7 +69,7 @@ static int PolygonalizationShader___init__(BPy_PolygonalizationShader *self,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*-----------------------BPy_PolygonalizationShader type definition ------------------------------*/
|
||||
/*-----------------------BPy_PolygonalizationShader type definition -----------------------------*/
|
||||
|
||||
PyTypeObject PolygonalizationShader_Type = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0) "PolygonalizationShader", /* tp_name */
|
||||
|
||||
@@ -62,7 +62,7 @@ static int StrokeTextureStepShader___init__(BPy_StrokeTextureStepShader *self,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*-----------------------BPy_StrokeTextureStepShader type definition ------------------------------*/
|
||||
/*-----------------------BPy_StrokeTextureStepShader type definition ----------------------------*/
|
||||
|
||||
PyTypeObject StrokeTextureStepShader_Type = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0) "StrokeTextureStepShader", /* tp_name */
|
||||
|
||||
@@ -115,7 +115,7 @@ static PyObject *UnaryFunction0DEdgeNature___call__(BPy_UnaryFunction0DEdgeNatur
|
||||
return BPy_Nature_from_Nature(self->uf0D_edgenature->result);
|
||||
}
|
||||
|
||||
/*-----------------------BPy_UnaryFunction0DEdgeNature type definition ------------------------------*/
|
||||
/*-----------------------BPy_UnaryFunction0DEdgeNature type definition --------------------------*/
|
||||
|
||||
PyTypeObject UnaryFunction0DEdgeNature_Type = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0) "UnaryFunction0DEdgeNature", /* tp_name */
|
||||
|
||||
@@ -114,7 +114,7 @@ static PyObject *UnaryFunction0DMaterial___call__(BPy_UnaryFunction0DMaterial *s
|
||||
return BPy_FrsMaterial_from_FrsMaterial(self->uf0D_material->result);
|
||||
}
|
||||
|
||||
/*-----------------------BPy_UnaryFunction0DMaterial type definition ------------------------------*/
|
||||
/*-----------------------BPy_UnaryFunction0DMaterial type definition ----------------------------*/
|
||||
|
||||
PyTypeObject UnaryFunction0DMaterial_Type = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0) "UnaryFunction0DMaterial", /* tp_name */
|
||||
|
||||
@@ -115,7 +115,7 @@ static PyObject *UnaryFunction0DUnsigned___call__(BPy_UnaryFunction0DUnsigned *s
|
||||
return PyLong_FromLong(self->uf0D_unsigned->result);
|
||||
}
|
||||
|
||||
/*-----------------------BPy_UnaryFunction0DUnsigned type definition ------------------------------*/
|
||||
/*-----------------------BPy_UnaryFunction0DUnsigned type definition ----------------------------*/
|
||||
|
||||
PyTypeObject UnaryFunction0DUnsigned_Type = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0) "UnaryFunction0DUnsigned", /* tp_name */
|
||||
|
||||
@@ -124,7 +124,7 @@ static PyObject *UnaryFunction0DVectorViewShape___call__(BPy_UnaryFunction0DVect
|
||||
return list;
|
||||
}
|
||||
|
||||
/*-----------------------BPy_UnaryFunction0DVectorViewShape type definition ------------------------------*/
|
||||
/*-----------------------BPy_UnaryFunction0DVectorViewShape type definition ---------------------*/
|
||||
|
||||
PyTypeObject UnaryFunction0DVectorViewShape_Type = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0) "UnaryFunction0DVectorViewShape", /* tp_name */
|
||||
|
||||
@@ -37,13 +37,15 @@ extern PyTypeObject UnaryFunction0DVectorViewShape_Type;
|
||||
#define BPy_UnaryFunction0DVectorViewShape_Check(v) \
|
||||
(PyObject_IsInstance((PyObject *)v, (PyObject *)&UnaryFunction0DVectorViewShape_Type))
|
||||
|
||||
/*---------------------------Python BPy_UnaryFunction0DVectorViewShape structure definition----------*/
|
||||
/*---------------------------Python BPy_UnaryFunction0DVectorViewShape structure
|
||||
* definition----------*/
|
||||
typedef struct {
|
||||
BPy_UnaryFunction0D py_uf0D;
|
||||
UnaryFunction0D<std::vector<ViewShape *>> *uf0D_vectorviewshape;
|
||||
} BPy_UnaryFunction0DVectorViewShape;
|
||||
|
||||
/*---------------------------Python BPy_UnaryFunction0DVectorViewShape visible prototypes-----------*/
|
||||
/*---------------------------Python BPy_UnaryFunction0DVectorViewShape visible
|
||||
* prototypes-----------*/
|
||||
int UnaryFunction0DVectorViewShape_Init(PyObject *module);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -121,7 +121,7 @@ static PyObject *UnaryFunction0DViewShape___call__(BPy_UnaryFunction0DViewShape
|
||||
return BPy_ViewShape_from_ViewShape(*(self->uf0D_viewshape->result));
|
||||
}
|
||||
|
||||
/*-----------------------BPy_UnaryFunction0DViewShape type definition ------------------------------*/
|
||||
/*-----------------------BPy_UnaryFunction0DViewShape type definition ---------------------------*/
|
||||
|
||||
PyTypeObject UnaryFunction0DViewShape_Type = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0) "UnaryFunction0DViewShape", /* tp_name */
|
||||
|
||||
@@ -64,7 +64,7 @@ static int VertexOrientation2DF0D___init__(BPy_VertexOrientation2DF0D *self,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*-----------------------BPy_VertexOrientation2DF0D type definition ------------------------------*/
|
||||
/*-----------------------BPy_VertexOrientation2DF0D type definition -----------------------------*/
|
||||
|
||||
PyTypeObject VertexOrientation2DF0D_Type = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0) "VertexOrientation2DF0D", /* tp_name */
|
||||
|
||||
@@ -64,7 +64,7 @@ static int VertexOrientation3DF0D___init__(BPy_VertexOrientation3DF0D *self,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*-----------------------BPy_VertexOrientation3DF0D type definition ------------------------------*/
|
||||
/*-----------------------BPy_VertexOrientation3DF0D type definition -----------------------------*/
|
||||
|
||||
PyTypeObject VertexOrientation3DF0D_Type = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0) "VertexOrientation3DF0D", /* tp_name */
|
||||
|
||||
@@ -62,7 +62,7 @@ static int GetCurvilinearAbscissaF0D___init__(BPy_GetCurvilinearAbscissaF0D *sel
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*-----------------------BPy_GetCurvilinearAbscissaF0D type definition ------------------------------*/
|
||||
/*-----------------------BPy_GetCurvilinearAbscissaF0D type definition --------------------------*/
|
||||
|
||||
PyTypeObject GetCurvilinearAbscissaF0D_Type = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0) "GetCurvilinearAbscissaF0D", /* tp_name */
|
||||
|
||||
@@ -67,7 +67,7 @@ static int GetViewMapGradientNormF0D___init__(BPy_GetViewMapGradientNormF0D *sel
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*-----------------------BPy_GetViewMapGradientNormF0D type definition ------------------------------*/
|
||||
/*-----------------------BPy_GetViewMapGradientNormF0D type definition --------------------------*/
|
||||
|
||||
PyTypeObject GetViewMapGradientNormF0D_Type = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0) "GetViewMapGradientNormF0D", /* tp_name */
|
||||
|
||||
@@ -65,7 +65,7 @@ static int ReadCompleteViewMapPixelF0D___init__(BPy_ReadCompleteViewMapPixelF0D
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*-----------------------BPy_ReadCompleteViewMapPixelF0D type definition ------------------------------*/
|
||||
/*-----------------------BPy_ReadCompleteViewMapPixelF0D type definition ------------------------*/
|
||||
|
||||
PyTypeObject ReadCompleteViewMapPixelF0D_Type = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0) "ReadCompleteViewMapPixelF0D", /* tp_name */
|
||||
|
||||
@@ -34,7 +34,8 @@ extern PyTypeObject ReadCompleteViewMapPixelF0D_Type;
|
||||
#define BPy_ReadCompleteViewMapPixelF0D_Check(v) \
|
||||
(PyObject_IsInstance((PyObject *)v, (PyObject *)&ReadCompleteViewMapPixelF0D_Type))
|
||||
|
||||
/*---------------------------Python BPy_ReadCompleteViewMapPixelF0D structure definition----------*/
|
||||
/*---------------------------Python BPy_ReadCompleteViewMapPixelF0D structure
|
||||
* definition----------*/
|
||||
typedef struct {
|
||||
BPy_UnaryFunction0DFloat py_uf0D_float;
|
||||
} BPy_ReadCompleteViewMapPixelF0D;
|
||||
|
||||
@@ -69,7 +69,7 @@ static int ReadSteerableViewMapPixelF0D___init__(BPy_ReadSteerableViewMapPixelF0
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*-----------------------BPy_ReadSteerableViewMapPixelF0D type definition ------------------------------*/
|
||||
/*-----------------------BPy_ReadSteerableViewMapPixelF0D type definition -----------------------*/
|
||||
|
||||
PyTypeObject ReadSteerableViewMapPixelF0D_Type = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0) "ReadSteerableViewMapPixelF0D", /* tp_name */
|
||||
|
||||
@@ -34,7 +34,8 @@ extern PyTypeObject ReadSteerableViewMapPixelF0D_Type;
|
||||
#define BPy_ReadSteerableViewMapPixelF0D_Check(v) \
|
||||
(PyObject_IsInstance((PyObject *)v, (PyObject *)&ReadSteerableViewMapPixelF0D_Type))
|
||||
|
||||
/*---------------------------Python BPy_ReadSteerableViewMapPixelF0D structure definition----------*/
|
||||
/*---------------------------Python BPy_ReadSteerableViewMapPixelF0D structure
|
||||
* definition----------*/
|
||||
typedef struct {
|
||||
BPy_UnaryFunction0DFloat py_uf0D_float;
|
||||
} BPy_ReadSteerableViewMapPixelF0D;
|
||||
|
||||
@@ -67,7 +67,7 @@ static int QuantitativeInvisibilityF0D___init__(BPy_QuantitativeInvisibilityF0D
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*-----------------------BPy_QuantitativeInvisibilityF0D type definition ------------------------------*/
|
||||
/*-----------------------BPy_QuantitativeInvisibilityF0D type definition ------------------------*/
|
||||
|
||||
PyTypeObject QuantitativeInvisibilityF0D_Type = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0) "QuantitativeInvisibilityF0D", /* tp_name */
|
||||
|
||||
@@ -34,7 +34,8 @@ extern PyTypeObject QuantitativeInvisibilityF0D_Type;
|
||||
#define BPy_QuantitativeInvisibilityF0D_Check(v) \
|
||||
(PyObject_IsInstance((PyObject *)v, (PyObject *)&QuantitativeInvisibilityF0D_Type))
|
||||
|
||||
/*---------------------------Python BPy_QuantitativeInvisibilityF0D structure definition----------*/
|
||||
/*---------------------------Python BPy_QuantitativeInvisibilityF0D structure
|
||||
* definition----------*/
|
||||
typedef struct {
|
||||
BPy_UnaryFunction0DUnsigned py_uf0D_unsigned;
|
||||
} BPy_QuantitativeInvisibilityF0D;
|
||||
|
||||
@@ -166,7 +166,7 @@ static PyGetSetDef BPy_UnaryFunction1DEdgeNature_getseters[] = {
|
||||
{NULL, NULL, NULL, NULL, NULL} /* Sentinel */
|
||||
};
|
||||
|
||||
/*-----------------------BPy_UnaryFunction1DEdgeNature type definition ------------------------------*/
|
||||
/*-----------------------BPy_UnaryFunction1DEdgeNature type definition --------------------------*/
|
||||
|
||||
PyTypeObject UnaryFunction1DEdgeNature_Type = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0) "UnaryFunction1DEdgeNature", /* tp_name */
|
||||
|
||||
@@ -166,7 +166,7 @@ static PyGetSetDef BPy_UnaryFunction1DUnsigned_getseters[] = {
|
||||
{NULL, NULL, NULL, NULL, NULL} /* Sentinel */
|
||||
};
|
||||
|
||||
/*-----------------------BPy_UnaryFunction1DUnsigned type definition ------------------------------*/
|
||||
/*-----------------------BPy_UnaryFunction1DUnsigned type definition ----------------------------*/
|
||||
|
||||
PyTypeObject UnaryFunction1DUnsigned_Type = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0) "UnaryFunction1DUnsigned", /* tp_name */
|
||||
|
||||
@@ -190,7 +190,7 @@ static PyGetSetDef BPy_UnaryFunction1DVectorViewShape_getseters[] = {
|
||||
{NULL, NULL, NULL, NULL, NULL} /* Sentinel */
|
||||
};
|
||||
|
||||
/*-----------------------BPy_UnaryFunction1DVectorViewShape type definition ------------------------------*/
|
||||
/*-----------------------BPy_UnaryFunction1DVectorViewShape type definition ---------------------*/
|
||||
|
||||
PyTypeObject UnaryFunction1DVectorViewShape_Type = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0) "UnaryFunction1DVectorViewShape", /* tp_name */
|
||||
|
||||
@@ -37,13 +37,15 @@ extern PyTypeObject UnaryFunction1DVectorViewShape_Type;
|
||||
#define BPy_UnaryFunction1DVectorViewShape_Check(v) \
|
||||
(PyObject_IsInstance((PyObject *)v, (PyObject *)&UnaryFunction1DVectorViewShape_Type))
|
||||
|
||||
/*---------------------------Python BPy_UnaryFunction1DVectorViewShape structure definition----------*/
|
||||
/*---------------------------Python BPy_UnaryFunction1DVectorViewShape structure
|
||||
* definition----------*/
|
||||
typedef struct {
|
||||
BPy_UnaryFunction1D py_uf1D;
|
||||
UnaryFunction1D<std::vector<ViewShape *>> *uf1D_vectorviewshape;
|
||||
} BPy_UnaryFunction1DVectorViewShape;
|
||||
|
||||
/*---------------------------Python BPy_UnaryFunction1DVectorViewShape visible prototypes-----------*/
|
||||
/*---------------------------Python BPy_UnaryFunction1DVectorViewShape visible
|
||||
* prototypes-----------*/
|
||||
int UnaryFunction1DVectorViewShape_Init(PyObject *module);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -84,7 +84,7 @@ static int GetCompleteViewMapDensityF1D___init__(BPy_GetCompleteViewMapDensityF1
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*-----------------------BPy_GetCompleteViewMapDensityF1D type definition ------------------------------*/
|
||||
/*-----------------------BPy_GetCompleteViewMapDensityF1D type definition -----------------------*/
|
||||
|
||||
PyTypeObject GetCompleteViewMapDensityF1D_Type = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0) "GetCompleteViewMapDensityF1D", /* tp_name */
|
||||
|
||||
@@ -34,7 +34,8 @@ extern PyTypeObject GetCompleteViewMapDensityF1D_Type;
|
||||
#define BPy_GetCompleteViewMapDensityF1D_Check(v) \
|
||||
(PyObject_IsInstance((PyObject *)v, (PyObject *)&GetCompleteViewMapDensityF1D_Type))
|
||||
|
||||
/*---------------------------Python BPy_GetCompleteViewMapDensityF1D structure definition----------*/
|
||||
/*---------------------------Python BPy_GetCompleteViewMapDensityF1D structure
|
||||
* definition----------*/
|
||||
typedef struct {
|
||||
BPy_UnaryFunction1DDouble py_uf1D_double;
|
||||
} BPy_GetCompleteViewMapDensityF1D;
|
||||
|
||||
@@ -91,7 +91,7 @@ static int GetDirectionalViewMapDensityF1D___init__(BPy_GetDirectionalViewMapDen
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*-----------------------BPy_GetDirectionalViewMapDensityF1D type definition ------------------------------*/
|
||||
/*-----------------------BPy_GetDirectionalViewMapDensityF1D type definition --------------------*/
|
||||
|
||||
PyTypeObject GetDirectionalViewMapDensityF1D_Type = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0) "GetDirectionalViewMapDensityF1D", /* tp_name */
|
||||
|
||||
@@ -34,7 +34,8 @@ extern PyTypeObject GetDirectionalViewMapDensityF1D_Type;
|
||||
#define BPy_GetDirectionalViewMapDensityF1D_Check(v) \
|
||||
(PyObject_IsInstance((PyObject *)v, (PyObject *)&GetDirectionalViewMapDensityF1D_Type))
|
||||
|
||||
/*---------------------------Python BPy_GetDirectionalViewMapDensityF1D structure definition----------*/
|
||||
/*---------------------------Python BPy_GetDirectionalViewMapDensityF1D structure
|
||||
* definition----------*/
|
||||
typedef struct {
|
||||
BPy_UnaryFunction1DDouble py_uf1D_double;
|
||||
} BPy_GetDirectionalViewMapDensityF1D;
|
||||
|
||||
@@ -81,7 +81,7 @@ static int GetSteerableViewMapDensityF1D___init__(BPy_GetSteerableViewMapDensity
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*-----------------------BPy_GetSteerableViewMapDensityF1D type definition ------------------------------*/
|
||||
/*-----------------------BPy_GetSteerableViewMapDensityF1D type definition ----------------------*/
|
||||
|
||||
PyTypeObject GetSteerableViewMapDensityF1D_Type = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0) "GetSteerableViewMapDensityF1D", /* tp_name */
|
||||
|
||||
@@ -33,7 +33,8 @@ extern PyTypeObject GetSteerableViewMapDensityF1D_Type;
|
||||
|
||||
#define BPy_GetSteerableViewMapDensityF1D_Check(v) \
|
||||
(PyObject_IsInstance((PyObject *)v, (PyObject *)&GetSteerableViewMapDensityF1D_Type))
|
||||
/*---------------------------Python BPy_GetSteerableViewMapDensityF1D structure definition----------*/
|
||||
/*---------------------------Python BPy_GetSteerableViewMapDensityF1D structure
|
||||
* definition----------*/
|
||||
typedef struct {
|
||||
BPy_UnaryFunction1DDouble py_uf1D_double;
|
||||
} BPy_GetSteerableViewMapDensityF1D;
|
||||
|
||||
@@ -81,7 +81,7 @@ static int GetViewMapGradientNormF1D___init__(BPy_GetViewMapGradientNormF1D *sel
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*-----------------------BPy_GetViewMapGradientNormF1D type definition ------------------------------*/
|
||||
/*-----------------------BPy_GetViewMapGradientNormF1D type definition --------------------------*/
|
||||
|
||||
PyTypeObject GetViewMapGradientNormF1D_Type = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0) "GetViewMapGradientNormF1D", /* tp_name */
|
||||
|
||||
@@ -72,7 +72,7 @@ static int QuantitativeInvisibilityF1D___init__(BPy_QuantitativeInvisibilityF1D
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*-----------------------BPy_QuantitativeInvisibilityF1D type definition ------------------------------*/
|
||||
/*-----------------------BPy_QuantitativeInvisibilityF1D type definition ------------------------*/
|
||||
|
||||
PyTypeObject QuantitativeInvisibilityF1D_Type = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0) "QuantitativeInvisibilityF1D", /* tp_name */
|
||||
|
||||
@@ -34,7 +34,8 @@ extern PyTypeObject QuantitativeInvisibilityF1D_Type;
|
||||
#define BPy_QuantitativeInvisibilityF1D_Check(v) \
|
||||
(PyObject_IsInstance((PyObject *)v, (PyObject *)&QuantitativeInvisibilityF1D_Type))
|
||||
|
||||
/*---------------------------Python BPy_QuantitativeInvisibilityF1D structure definition----------*/
|
||||
/*---------------------------Python BPy_QuantitativeInvisibilityF1D structure
|
||||
* definition----------*/
|
||||
typedef struct {
|
||||
BPy_UnaryFunction1DUnsigned py_uf1D_unsigned;
|
||||
} BPy_QuantitativeInvisibilityF1D;
|
||||
|
||||
@@ -59,7 +59,7 @@ static int IncrementChainingTimeStampF1D___init__(BPy_IncrementChainingTimeStamp
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*-----------------------BPy_IncrementChainingTimeStampF1D type definition ------------------------------*/
|
||||
/*-----------------------BPy_IncrementChainingTimeStampF1D type definition ----------------------*/
|
||||
|
||||
PyTypeObject IncrementChainingTimeStampF1D_Type = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0) "IncrementChainingTimeStampF1D", /* tp_name */
|
||||
|
||||
@@ -34,7 +34,8 @@ extern PyTypeObject IncrementChainingTimeStampF1D_Type;
|
||||
#define BPy_IncrementChainingTimeStampF1D_Check(v) \
|
||||
(PyObject_IsInstance((PyObject *)v, (PyObject *)&IncrementChainingTimeStampF1D_Type))
|
||||
|
||||
/*---------------------------Python BPy_IncrementChainingTimeStampF1D structure definition----------*/
|
||||
/*---------------------------Python BPy_IncrementChainingTimeStampF1D structure
|
||||
* definition----------*/
|
||||
typedef struct {
|
||||
BPy_UnaryFunction1DVoid py_uf1D_void;
|
||||
} BPy_IncrementChainingTimeStampF1D;
|
||||
|
||||
@@ -62,7 +62,7 @@ static int EqualToChainingTimeStampUP1D___init__(BPy_EqualToChainingTimeStampUP1
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*-----------------------BPy_EqualToChainingTimeStampUP1D type definition ------------------------------*/
|
||||
/*-----------------------BPy_EqualToChainingTimeStampUP1D type definition -----------------------*/
|
||||
|
||||
PyTypeObject EqualToChainingTimeStampUP1D_Type = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0) "EqualToChainingTimeStampUP1D", /* tp_name */
|
||||
|
||||
@@ -34,7 +34,8 @@ extern PyTypeObject EqualToChainingTimeStampUP1D_Type;
|
||||
#define BPy_EqualToChainingTimeStampUP1D_Check(v) \
|
||||
(PyObject_IsInstance((PyObject *)v, (PyObject *)&EqualToChainingTimeStampUP1D_Type))
|
||||
|
||||
/*---------------------------Python BPy_EqualToChainingTimeStampUP1D structure definition----------*/
|
||||
/*---------------------------Python BPy_EqualToChainingTimeStampUP1D structure
|
||||
* definition----------*/
|
||||
typedef struct {
|
||||
BPy_UnaryPredicate1D py_up1D;
|
||||
} BPy_EqualToChainingTimeStampUP1D;
|
||||
|
||||
@@ -66,7 +66,7 @@ static int QuantitativeInvisibilityUP1D___init__(BPy_QuantitativeInvisibilityUP1
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*-----------------------BPy_QuantitativeInvisibilityUP1D type definition ------------------------------*/
|
||||
/*-----------------------BPy_QuantitativeInvisibilityUP1D type definition -----------------------*/
|
||||
|
||||
PyTypeObject QuantitativeInvisibilityUP1D_Type = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0) "QuantitativeInvisibilityUP1D", /* tp_name */
|
||||
|
||||
@@ -34,7 +34,8 @@ extern PyTypeObject QuantitativeInvisibilityUP1D_Type;
|
||||
#define BPy_QuantitativeInvisibilityUP1D_Check(v) \
|
||||
(PyObject_IsInstance((PyObject *)v, (PyObject *)&QuantitativeInvisibilityUP1D_Type))
|
||||
|
||||
/*---------------------------Python BPy_QuantitativeInvisibilityUP1D structure definition----------*/
|
||||
/*---------------------------Python BPy_QuantitativeInvisibilityUP1D structure
|
||||
* definition----------*/
|
||||
typedef struct {
|
||||
BPy_UnaryPredicate1D py_up1D;
|
||||
} BPy_QuantitativeInvisibilityUP1D;
|
||||
|
||||
@@ -99,13 +99,11 @@ class IndexedFaceSet : public Rep {
|
||||
* iMISize
|
||||
* The size of iMIndices
|
||||
* iTIndices
|
||||
* The Texture coordinates indices (per vertex). The integers contained in this array must be multiple of 2.
|
||||
* iTISize
|
||||
* The size of iMIndices
|
||||
* iCopy
|
||||
* 0 : the arrays are not copied. The pointers passed as arguments are used. IndexedFaceSet takes these
|
||||
* arrays desallocation in charge.
|
||||
* 1 : the arrays are copied. The caller is in charge of the arrays, passed as arguments desallocation.
|
||||
* The Texture coordinates indices (per vertex). The integers contained in this array must
|
||||
* be multiple of 2. iTISize The size of iMIndices iCopy 0 : the arrays are not copied. The
|
||||
* pointers passed as arguments are used. IndexedFaceSet takes these arrays desallocation in
|
||||
* charge. 1 : the arrays are copied. The caller is in charge of the arrays, passed as arguments
|
||||
* desallocation.
|
||||
*/
|
||||
IndexedFaceSet(float *iVertices,
|
||||
unsigned iVSize,
|
||||
|
||||
@@ -19,7 +19,8 @@
|
||||
|
||||
/** \file
|
||||
* \ingroup freestyle
|
||||
* \brief Abstract class for scene graph nodes. Inherits from BaseObject which defines the addRef release mechanism.
|
||||
* \brief Abstract class for scene graph nodes. Inherits from BaseObject which defines the addRef
|
||||
* release mechanism.
|
||||
*/
|
||||
|
||||
#include "SceneVisitor.h"
|
||||
|
||||
@@ -16,7 +16,8 @@
|
||||
|
||||
/** \file
|
||||
* \ingroup freestyle
|
||||
* \brief Class to define a Drawing Style to be applied to the underlying children. Inherits from NodeGroup.
|
||||
* \brief Class to define a Drawing Style to be applied to the underlying children. Inherits from
|
||||
* NodeGroup.
|
||||
*/
|
||||
|
||||
#include "NodeDrawingStyle.h"
|
||||
|
||||
@@ -19,7 +19,8 @@
|
||||
|
||||
/** \file
|
||||
* \ingroup freestyle
|
||||
* \brief Class to define a Drawing Style to be applied to the underlying children. Inherits from NodeGroup.
|
||||
* \brief Class to define a Drawing Style to be applied to the underlying children. Inherits from
|
||||
* NodeGroup.
|
||||
*/
|
||||
|
||||
#include "DrawingStyle.h"
|
||||
|
||||
@@ -17,7 +17,8 @@
|
||||
/** \file
|
||||
* \ingroup freestyle
|
||||
* \brief Class to represent a group node. This node can contains several children.
|
||||
* \brief It also contains a transform matrix indicating the transform state of the underlying children.
|
||||
* \brief It also contains a transform matrix indicating the transform state of the underlying
|
||||
* children.
|
||||
*/
|
||||
|
||||
#include "NodeGroup.h"
|
||||
@@ -36,10 +37,9 @@ void NodeGroup::AddChild(Node *iChild)
|
||||
int NodeGroup::destroy()
|
||||
{
|
||||
/*! Node::destroy makes a release on the object and then returns the reference counter.
|
||||
* If the reference counter is equal to 0, that means that nobody else is linking this node group and
|
||||
* that we can destroy the whole underlying tree.
|
||||
* Else, one or several Node link this node group, and we only returns the reference counter
|
||||
* decremented by Node::destroy();
|
||||
* If the reference counter is equal to 0, that means that nobody else is linking this node
|
||||
* group and that we can destroy the whole underlying tree. Else, one or several Node link this
|
||||
* node group, and we only returns the reference counter decremented by Node::destroy();
|
||||
*/
|
||||
int refThis = Node::destroy();
|
||||
|
||||
|
||||
@@ -20,7 +20,8 @@
|
||||
/** \file
|
||||
* \ingroup freestyle
|
||||
* \brief Class to represent a group node. This node can contains several children.
|
||||
* \brief It also contains a transform matrix indicating the transform state of the underlying children.
|
||||
* \brief It also contains a transform matrix indicating the transform state of the underlying
|
||||
* children.
|
||||
*/
|
||||
|
||||
#include <vector>
|
||||
|
||||
@@ -35,7 +35,7 @@ void NodeTransform::Translate(real x, real y, real z)
|
||||
|
||||
void NodeTransform::Rotate(real iAngle, real x, real y, real z)
|
||||
{
|
||||
//Normalize the x,y,z vector;
|
||||
// Normalize the x,y,z vector;
|
||||
real norm = (real)sqrt(x * x + y * y + z * z);
|
||||
if (0 == norm)
|
||||
return;
|
||||
|
||||
@@ -16,7 +16,8 @@
|
||||
|
||||
/** \file
|
||||
* \ingroup freestyle
|
||||
* \brief Base class for all shapes. Inherits from BasicObjects for references counter management (addRef, release).
|
||||
* \brief Base class for all shapes. Inherits from BasicObjects for references counter management
|
||||
* (addRef, release).
|
||||
*/
|
||||
|
||||
#include "Rep.h"
|
||||
|
||||
@@ -19,7 +19,8 @@
|
||||
|
||||
/** \file
|
||||
* \ingroup freestyle
|
||||
* \brief Base class for all shapes. Inherits from BasicObjects for references counter management (addRef, release).
|
||||
* \brief Base class for all shapes.
|
||||
* Inherits from BasicObjects for references counter management (addRef, release).
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
@@ -111,8 +112,8 @@ class Rep : public BaseObject {
|
||||
}
|
||||
|
||||
/*! Computes the rep bounding box.
|
||||
* Each Inherited rep must compute its bbox depending on the way the data are stored. So, each inherited class
|
||||
* must overload this method
|
||||
* Each Inherited rep must compute its bbox depending on the way the data are stored. So, each
|
||||
* inherited class must overload this method
|
||||
*/
|
||||
virtual void ComputeBBox() = 0;
|
||||
|
||||
|
||||
@@ -38,15 +38,15 @@ namespace Functions0D {
|
||||
|
||||
// DensityF0D
|
||||
/*! Returns the density of the (result) image evaluated at an Interface0D.
|
||||
* This density is evaluated using a pixels square window around the evaluation point and integrating
|
||||
* these values using a gaussian.
|
||||
* This density is evaluated using a pixels square window around the evaluation point and
|
||||
* integrating these values using a gaussian.
|
||||
*/
|
||||
class DensityF0D : public UnaryFunction0D<double> {
|
||||
public:
|
||||
/*! Builds the functor from the gaussian sigma value.
|
||||
* \param sigma:
|
||||
* sigma indicates the x value for which the gaussian function is 0.5. It leads to the window size value.
|
||||
* (the larger, the smoother)
|
||||
* sigma indicates the x value for which the gaussian function is 0.5.
|
||||
* It leads to the window size value. (the larger, the smoother)
|
||||
*/
|
||||
DensityF0D(double sigma = 2) : UnaryFunction0D<double>()
|
||||
{
|
||||
|
||||
@@ -104,14 +104,14 @@ int GetSteerableViewMapDensityF1D::operator()(Interface1D &inter)
|
||||
|
||||
int GetDirectionalViewMapDensityF1D::operator()(Interface1D &inter)
|
||||
{
|
||||
//soc unsigned size;
|
||||
// soc unsigned size;
|
||||
result = integrate(_fun, inter.pointsBegin(_sampling), inter.pointsEnd(_sampling), _integration);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int GetCompleteViewMapDensityF1D::operator()(Interface1D &inter)
|
||||
{
|
||||
//soc unsigned size;
|
||||
// soc unsigned size;
|
||||
/* Id id = inter.getId(); */ /* UNUSED */
|
||||
result = integrate(_fun, inter.pointsBegin(_sampling), inter.pointsEnd(_sampling), _integration);
|
||||
return 0;
|
||||
|
||||
@@ -37,8 +37,9 @@ namespace Functions1D {
|
||||
|
||||
// DensityF1D
|
||||
/*! Returns the density evaluated for an Interface1D.
|
||||
* The density is evaluated for a set of points along the Interface1D (using the DensityF0D functor) with a
|
||||
* user-defined sampling and then integrated into a single value using a user-defined integration method.
|
||||
* The density is evaluated for a set of points along the Interface1D (using the DensityF0D
|
||||
* functor) with a user-defined sampling and then integrated into a single value using a
|
||||
* user-defined integration method.
|
||||
*/
|
||||
class DensityF1D : public UnaryFunction1D<double> {
|
||||
private:
|
||||
@@ -51,9 +52,9 @@ class DensityF1D : public UnaryFunction1D<double> {
|
||||
* \param iType:
|
||||
* The integration method used to compute a single value from a set of values.
|
||||
* \param sampling:
|
||||
* The resolution used to sample the chain: the corresponding 0D function is evaluated at each sample point and
|
||||
* the result is obtained by combining the resulting values into a single one, following the method specified
|
||||
* by iType.
|
||||
* The resolution used to sample the chain: the corresponding 0D function is evaluated at each
|
||||
* sample point and the result is obtained by combining the resulting values into a single one,
|
||||
* following the method specified by iType.
|
||||
*/
|
||||
DensityF1D(double sigma = 2, IntegrationType iType = MEAN, float sampling = 2.0f)
|
||||
: UnaryFunction1D<double>(iType), _fun(sigma)
|
||||
@@ -86,8 +87,9 @@ class DensityF1D : public UnaryFunction1D<double> {
|
||||
|
||||
// LocalAverageDepthF1D
|
||||
/*! Returns the average depth evaluated for an Interface1D.
|
||||
* The average depth is evaluated for a set of points along the Interface1D (using the LocalAverageDepthF0D functor)
|
||||
* with a user-defined sampling and then integrated into a single value using a user-defined integration method.
|
||||
* The average depth is evaluated for a set of points along the Interface1D (using the
|
||||
* LocalAverageDepthF0D functor) with a user-defined sampling and then integrated into a single
|
||||
* value using a user-defined integration method.
|
||||
*/
|
||||
class LocalAverageDepthF1D : public UnaryFunction1D<double> {
|
||||
public:
|
||||
@@ -121,8 +123,9 @@ class LocalAverageDepthF1D : public UnaryFunction1D<double> {
|
||||
|
||||
// GetCompleteViewMapDensity
|
||||
/*! Returns the density evaluated for an Interface1D in the complete viewmap image.
|
||||
* The density is evaluated for a set of points along the Interface1D (using the ReadCompleteViewMapPixelF0D functor)
|
||||
* and then integrated into a single value using a user-defined integration method.
|
||||
* The density is evaluated for a set of points along the Interface1D (using the
|
||||
* ReadCompleteViewMapPixelF0D functor) and then integrated into a single value using a
|
||||
* user-defined integration method.
|
||||
*/
|
||||
class GetCompleteViewMapDensityF1D : public UnaryFunction1D<double> {
|
||||
public:
|
||||
@@ -162,7 +165,8 @@ class GetCompleteViewMapDensityF1D : public UnaryFunction1D<double> {
|
||||
// GetDirectionalViewMapDensity
|
||||
/*! Returns the density evaluated for an Interface1D in of the steerable viewmaps image.
|
||||
* The direction telling which Directional map to choose is explicitly specified by the user.
|
||||
* The density is evaluated for a set of points along the Interface1D (using the ReadSteerableViewMapPixelF0D functor)
|
||||
* The density is evaluated for a set of points along the Interface1D
|
||||
* (using the ReadSteerableViewMapPixelF0D functor)
|
||||
* and then integrated into a single value using a user-defined integration method.
|
||||
*/
|
||||
class GetDirectionalViewMapDensityF1D : public UnaryFunction1D<double> {
|
||||
@@ -175,9 +179,9 @@ class GetDirectionalViewMapDensityF1D : public UnaryFunction1D<double> {
|
||||
* \param iType:
|
||||
* The integration method used to compute a single value from a set of values.
|
||||
* \param sampling:
|
||||
* The resolution used to sample the chain: the corresponding 0D function is evaluated at each sample point and
|
||||
* the result is obtained by combining the resulting values into a single one, following the method specified
|
||||
* by iType.
|
||||
* The resolution used to sample the chain: the corresponding 0D function is evaluated at
|
||||
* each sample point and the result is obtained by combining the resulting values into a
|
||||
* single one, following the method specified by iType.
|
||||
*/
|
||||
GetDirectionalViewMapDensityF1D(unsigned iOrientation,
|
||||
unsigned level,
|
||||
@@ -203,8 +207,8 @@ class GetDirectionalViewMapDensityF1D : public UnaryFunction1D<double> {
|
||||
};
|
||||
|
||||
// GetSteerableViewMapDensityF1D
|
||||
/*! Returns the density of the viewmap for a given Interface1D. The density of each FEdge is evaluated
|
||||
* in the proper steerable ViewMap depending on its oorientation.
|
||||
/*! Returns the density of the viewmap for a given Interface1D. The density of each FEdge is
|
||||
* evaluated in the proper steerable ViewMap depending on its oorientation.
|
||||
*/
|
||||
class GetSteerableViewMapDensityF1D : public UnaryFunction1D<double> {
|
||||
private:
|
||||
@@ -218,9 +222,9 @@ class GetSteerableViewMapDensityF1D : public UnaryFunction1D<double> {
|
||||
* \param iType:
|
||||
* The integration method used to compute a single value from a set of values.
|
||||
* \param sampling:
|
||||
* The resolution used to sample the chain: the corresponding 0D function is evaluated at each sample point and
|
||||
* the result is obtained by combining the resulting values into a single one, following the method specified
|
||||
* by iType.
|
||||
* The resolution used to sample the chain: the corresponding 0D function is evaluated at each
|
||||
* sample point and the result is obtained by combining the resulting values into a single one,
|
||||
* following the method specified by iType.
|
||||
*/
|
||||
GetSteerableViewMapDensityF1D(int level, IntegrationType iType = MEAN, float sampling = 2.0f)
|
||||
: UnaryFunction1D<double>(iType)
|
||||
@@ -245,8 +249,8 @@ class GetSteerableViewMapDensityF1D : public UnaryFunction1D<double> {
|
||||
};
|
||||
|
||||
// GetViewMapGradientNormF1D
|
||||
/*! Returns the density of the viewmap for a given Interface1D. The density of each FEdge is evaluated in
|
||||
* the proper steerable ViewMap depending on its oorientation.
|
||||
/*! Returns the density of the viewmap for a given Interface1D. The density of each FEdge is
|
||||
* evaluated in the proper steerable ViewMap depending on its oorientation.
|
||||
*/
|
||||
class GetViewMapGradientNormF1D : public UnaryFunction1D<double> {
|
||||
private:
|
||||
@@ -261,9 +265,9 @@ class GetViewMapGradientNormF1D : public UnaryFunction1D<double> {
|
||||
* \param iType:
|
||||
* The integration method used to compute a single value from a set of values.
|
||||
* \param sampling:
|
||||
* The resolution used to sample the chain: the corresponding 0D function is evaluated at each sample point and
|
||||
* the result is obtained by combining the resulting values into a single one, following the method specified
|
||||
* by iType.
|
||||
* The resolution used to sample the chain: the corresponding 0D function is evaluated at each
|
||||
* sample point and the result is obtained by combining the resulting values into a single
|
||||
* one, following the method specified by iType.
|
||||
*/
|
||||
GetViewMapGradientNormF1D(int level, IntegrationType iType = MEAN, float sampling = 2.0f)
|
||||
: UnaryFunction1D<double>(iType), _func(level)
|
||||
|
||||
@@ -261,7 +261,7 @@ void Smoother::iteration()
|
||||
edgeStopping(diffC2, _anisoCurvature) *
|
||||
diffC2; //_factorCurvatureDifference;
|
||||
motionCurvature *= _factorCurvatureDifference;
|
||||
//motionCurvature = _factorCurvatureDifference * (diffC1 + diffC2);
|
||||
// motionCurvature = _factorCurvatureDifference * (diffC1 + diffC2);
|
||||
if (_safeTest)
|
||||
_vertex[i] = Vec2r(_vertex[i] + (motionNormal + motionCurvature) * _normal[i]);
|
||||
Vec2r v1(_vertex[i - 1] - _vertex[i]);
|
||||
@@ -283,7 +283,7 @@ void Smoother::iteration()
|
||||
edgeStopping(diffC2, _anisoCurvature) *
|
||||
diffC2; //_factorCurvatureDifference;
|
||||
motionCurvature *= _factorCurvatureDifference;
|
||||
//motionCurvature = _factorCurvatureDifference * (diffC1 + diffC2);
|
||||
// motionCurvature = _factorCurvatureDifference * (diffC1 + diffC2);
|
||||
_vertex[0] = Vec2r(_vertex[0] + (motionNormal + motionCurvature) * _normal[0]);
|
||||
_vertex[_nbVertices - 1] = _vertex[0];
|
||||
}
|
||||
|
||||
@@ -27,9 +27,9 @@
|
||||
namespace Freestyle {
|
||||
|
||||
/*! [ Thickness Shader ].
|
||||
* Assigns thicknesses to the stroke vertices so that the stroke looks like made with a calligraphic tool.
|
||||
* i.e. The stroke will be the thickest in a main direction, the thinest in the direction perpendicular to this one,
|
||||
* and an interpolation inbetween.
|
||||
* Assigns thicknesses to the stroke vertices so that the stroke looks like made with a
|
||||
* calligraphic tool. i.e. The stroke will be the thickest in a main direction, the thinest in the
|
||||
* direction perpendicular to this one, and an interpolation inbetween.
|
||||
*/
|
||||
class CalligraphicShader : public StrokeShader {
|
||||
public:
|
||||
@@ -103,9 +103,9 @@ class SpatialNoiseShader : public StrokeShader {
|
||||
/*! [ Geometry Shader ].
|
||||
* Smoothes the stroke.
|
||||
* (Moves the vertices to make the stroke smoother).
|
||||
* Uses curvature flow to converge towards a curve of constant curvature. The diffusion method we use is anisotropic
|
||||
* to prevent the diffusion accross corners.
|
||||
* \see \htmlonly <a href=/smoothing/smoothing.html>smoothing/smoothing.html</a> \endhtmlonly
|
||||
* Uses curvature flow to converge towards a curve of constant curvature. The diffusion method we
|
||||
* use is anisotropic to prevent the diffusion accross corners. \see \htmlonly <a
|
||||
* href=/smoothing/smoothing.html>smoothing/smoothing.html</a> \endhtmlonly
|
||||
*/
|
||||
class SmoothingShader : public StrokeShader {
|
||||
public:
|
||||
|
||||
@@ -57,7 +57,8 @@ int ConstantThicknessShader::shade(Stroke &stroke) const
|
||||
int i = 0;
|
||||
int size = stroke.strokeVerticesSize();
|
||||
for (v = stroke.strokeVerticesBegin(), vend = stroke.strokeVerticesEnd(); v != vend; ++v) {
|
||||
// XXX What's the use of i here? And is not the thickness always overriden by the last line of the loop?
|
||||
// XXX What's the use of i here? And is not the thickness always overriden by the last line of
|
||||
// the loop?
|
||||
if ((1 == i) || (size - 2 == i))
|
||||
v->attribute().setThickness(_thickness / 4.0, _thickness / 4.0);
|
||||
if ((0 == i) || (size - 1 == i))
|
||||
@@ -74,7 +75,8 @@ int ConstantExternThicknessShader::shade(Stroke &stroke) const
|
||||
int i = 0;
|
||||
int size = stroke.strokeVerticesSize();
|
||||
for (v = stroke.strokeVerticesBegin(), vend = stroke.strokeVerticesEnd(); v != vend; ++v) {
|
||||
// XXX What's the use of i here? And is not the thickness always overriden by the last line of the loop?
|
||||
// XXX What's the use of i here? And is not the thickness always overriden by the last line of
|
||||
// the loop?
|
||||
if ((1 == i) || (size - 2 == i))
|
||||
v->attribute().setThickness(_thickness / 2.0, 0);
|
||||
if ((0 == i) || (size - 1 == i))
|
||||
@@ -109,7 +111,8 @@ int ConstrainedIncreasingThicknessShader::shade(Stroke &stroke) const
|
||||
StrokeInternal::StrokeVertexIterator v, vend;
|
||||
for (i = 0, v = stroke.strokeVerticesBegin(), vend = stroke.strokeVerticesEnd(); v != vend;
|
||||
++v, ++i) {
|
||||
// XXX Why not using an if/else here? Else, if last condition is true, everything else is computed for nothing!
|
||||
// XXX Why not using an if/else here? Else, if last condition is true, everything else is
|
||||
// computed for nothing!
|
||||
float t;
|
||||
if (i < (float)n / 2.0f)
|
||||
t = (1.0 - (float)i / (float)n) * _ThicknessMin + (float)i / (float)n * maxT;
|
||||
@@ -140,7 +143,8 @@ int LengthDependingThicknessShader::shade(Stroke &stroke) const
|
||||
int i = 0;
|
||||
int size = stroke.strokeVerticesSize();
|
||||
for (v = stroke.strokeVerticesBegin(), vend = stroke.strokeVerticesEnd(); v != vend; ++v) {
|
||||
// XXX What's the use of i here? And is not the thickness always overriden by the last line of the loop?
|
||||
// XXX What's the use of i here? And is not the thickness always overriden by the last line of
|
||||
// the loop?
|
||||
if ((1 == i) || (size - 2 == i))
|
||||
v->attribute().setThickness(thickness / 4.0, thickness / 4.0);
|
||||
if ((0 == i) || (size - 1 == i))
|
||||
@@ -337,7 +341,7 @@ int SamplingShader::shade(Stroke &stroke) const
|
||||
|
||||
int ExternalContourStretcherShader::shade(Stroke &stroke) const
|
||||
{
|
||||
//float l = stroke.getLength2D();
|
||||
// float l = stroke.getLength2D();
|
||||
Interface0DIterator it;
|
||||
Functions0D::Normal2DF0D fun;
|
||||
StrokeVertex *sv;
|
||||
@@ -362,7 +366,7 @@ int BezierCurveShader::shade(Stroke &stroke) const
|
||||
// Build the Bezier curve from this set of data points:
|
||||
vector<Vec2d> data;
|
||||
StrokeInternal::StrokeVertexIterator v = stroke.strokeVerticesBegin(), vend;
|
||||
data.push_back(Vec2d(v->x(), v->y())); //first one
|
||||
data.push_back(Vec2d(v->x(), v->y())); // first one
|
||||
StrokeInternal::StrokeVertexIterator previous = v;
|
||||
++v;
|
||||
for (vend = stroke.strokeVerticesEnd(); v != vend; ++v) {
|
||||
@@ -562,7 +566,7 @@ int PolygonalizationShader::shade(Stroke &stroke) const
|
||||
Vec2d u = (*cp)->B - (*cp)->A;
|
||||
Vec2d n(u[1], -u[0]);
|
||||
n.normalize();
|
||||
//Vec2d n(0, 0);
|
||||
// Vec2d n(0, 0);
|
||||
float offset = ((*cp)->_error);
|
||||
StrokeInternal::StrokeVertexIterator v;
|
||||
for (v = a; v != b; ++v) {
|
||||
@@ -653,7 +657,7 @@ int TipRemoverShader::shade(Stroke &stroke) const
|
||||
// Resample so that our new stroke have the same number of vertices than before
|
||||
stroke.Resample(originalSize);
|
||||
|
||||
if ((int)stroke.strokeVerticesSize() != originalSize) //soc
|
||||
if ((int)stroke.strokeVerticesSize() != originalSize) // soc
|
||||
cerr << "Warning: resampling problem" << endl;
|
||||
|
||||
// assign old attributes to new stroke vertices:
|
||||
|
||||
@@ -81,9 +81,9 @@ class ConstantThicknessShader : public StrokeShader {
|
||||
};
|
||||
|
||||
/* [ Thickness Shader ].
|
||||
* Assigns an absolute constant external thickness to every vertices of the Stroke. The external thickness of a point
|
||||
* is its thickness from the point to the strip border in the direction pointing outside the object the
|
||||
* Stroke delimitates.
|
||||
* Assigns an absolute constant external thickness to every vertices of the Stroke. The external
|
||||
* thickness of a point is its thickness from the point to the strip border in the direction
|
||||
* pointing outside the object the Stroke delimitates.
|
||||
*/
|
||||
class ConstantExternThicknessShader : public StrokeShader {
|
||||
public:
|
||||
@@ -108,10 +108,10 @@ class ConstantExternThicknessShader : public StrokeShader {
|
||||
};
|
||||
|
||||
/*! [ Thickness Shader ].
|
||||
* Assigns thicknesses values such as the thickness increases from a thickness value A to a thickness value B between
|
||||
* the first vertex to the midpoint vertex and then decreases from B to a A between this midpoint vertex
|
||||
* and the last vertex.
|
||||
* The thickness is linearly interpolated from A to B.
|
||||
* Assigns thicknesses values such as the thickness increases from a thickness value A to a
|
||||
* thickness value B between the first vertex to the midpoint vertex and then decreases from B to a
|
||||
* A between this midpoint vertex and the last vertex. The thickness is linearly interpolated from
|
||||
* A to B.
|
||||
*/
|
||||
class IncreasingThicknessShader : public StrokeShader {
|
||||
public:
|
||||
@@ -146,8 +146,8 @@ class IncreasingThicknessShader : public StrokeShader {
|
||||
};
|
||||
|
||||
/*! [ Thickness shader ].
|
||||
* Same as previous but here we allow the user to control the ratio thickness/length so that we don't get
|
||||
* fat short lines
|
||||
* Same as previous but here we allow the user to control the ratio thickness/length so that we
|
||||
* don't get fat short lines
|
||||
*/
|
||||
class ConstrainedIncreasingThicknessShader : public StrokeShader {
|
||||
private:
|
||||
@@ -288,8 +288,8 @@ class ConstantColorShader : public StrokeShader {
|
||||
|
||||
/*! [ Color Shader ].
|
||||
* Assigns a varying color to the stroke.
|
||||
* The user specifies 2 colors A and B. The stroke color will change linearly from A to B between the
|
||||
* first and the last vertex.
|
||||
* The user specifies 2 colors A and B. The stroke color will change linearly from A to B between
|
||||
* the first and the last vertex.
|
||||
*/
|
||||
class IncreasingColorShader : public StrokeShader {
|
||||
private:
|
||||
@@ -346,7 +346,8 @@ class IncreasingColorShader : public StrokeShader {
|
||||
};
|
||||
|
||||
/* [ Color Shader ].
|
||||
* Assigns a color to the stroke depending on the material of the shape to which ot belongs to. (Disney shader)
|
||||
* Assigns a color to the stroke depending on the material of the shape to which ot belongs to.
|
||||
* (Disney shader)
|
||||
*/
|
||||
class MaterialColorShader : public StrokeShader {
|
||||
private:
|
||||
@@ -399,7 +400,8 @@ class ColorNoiseShader : public StrokeShader {
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/*! [ Geometry Shader ].
|
||||
* Stretches the stroke at its two extremities and following the respective directions: v(1)v(0) and v(n-1)v(n).
|
||||
* Stretches the stroke at its two extremities and following the respective directions: v(1)v(0)
|
||||
* and v(n-1)v(n).
|
||||
*/
|
||||
class BackboneStretcherShader : public StrokeShader {
|
||||
private:
|
||||
@@ -471,9 +473,9 @@ class ExternalContourStretcherShader : public StrokeShader {
|
||||
|
||||
// Bezier curve stroke shader
|
||||
/*! [ Geometry Shader ].
|
||||
* Transforms the stroke backbone geometry so that it corresponds to a Bezier Curve approximation of the
|
||||
* original backbone geometry.
|
||||
* \see \htmlonly <a href=bezier/bezier.html>bezier/bezier.html</a> \endhtmlonly
|
||||
* Transforms the stroke backbone geometry so that it corresponds to a Bezier Curve approximation
|
||||
* of the original backbone geometry. \see \htmlonly <a
|
||||
* href=bezier/bezier.html>bezier/bezier.html</a> \endhtmlonly
|
||||
*/
|
||||
class BezierCurveShader : public StrokeShader {
|
||||
private:
|
||||
@@ -501,8 +503,9 @@ class BezierCurveShader : public StrokeShader {
|
||||
|
||||
/*! [ Geometry Shader ].
|
||||
* Shader to modify the Stroke geometry so that it looks more "polygonal".
|
||||
* The basic idea is to start from the minimal stroke approximation consisting in a line joining the first vertex
|
||||
* to the last one and to subdivide using the original stroke vertices until a certain error is reached.
|
||||
* The basic idea is to start from the minimal stroke approximation consisting in a line joining
|
||||
* the first vertex to the last one and to subdivide using the original stroke vertices until a
|
||||
* certain error is reached.
|
||||
*/
|
||||
class PolygonalizationShader : public StrokeShader {
|
||||
private:
|
||||
@@ -511,9 +514,9 @@ class PolygonalizationShader : public StrokeShader {
|
||||
public:
|
||||
/*! Builds the shader.
|
||||
* \param iError:
|
||||
* The error we want our polygonal approximation to have with respect to the original geometry.
|
||||
* The smaller, the closer the new stroke to the orinal one.
|
||||
* This error corresponds to the maximum distance between the new stroke and the old one.
|
||||
* The error we want our polygonal approximation to have with respect to the original
|
||||
* geometry. The smaller, the closer the new stroke to the orinal one. This error corresponds to
|
||||
* the maximum distance between the new stroke and the old one.
|
||||
*/
|
||||
PolygonalizationShader(float iError) : StrokeShader()
|
||||
{
|
||||
@@ -542,8 +545,9 @@ class GuidingLinesShader : public StrokeShader {
|
||||
public:
|
||||
/*! Builds a Guiding Lines shader
|
||||
* \param iOffset:
|
||||
* The line that replaces the stroke is initially in the middle of the initial stroke "bbox".
|
||||
* iOffset is the value of the displacement which is applied to this line along its normal.
|
||||
* The line that replaces the stroke is initially in the middle of the initial stroke
|
||||
* "bbox". iOffset is the value of the displacement which is applied to this line along its
|
||||
* normal.
|
||||
*/
|
||||
GuidingLinesShader(float iOffset) : StrokeShader()
|
||||
{
|
||||
|
||||
@@ -38,8 +38,8 @@
|
||||
|
||||
#include "BKE_global.h"
|
||||
|
||||
//soc #include <qimage.h>
|
||||
//soc #include <QString>
|
||||
// soc #include <qimage.h>
|
||||
// soc #include <QString>
|
||||
|
||||
extern "C" {
|
||||
#include "IMB_imbuf.h"
|
||||
@@ -325,7 +325,7 @@ void Canvas::loadMap(const char *iFileName,
|
||||
filePath = iFileName;
|
||||
}
|
||||
|
||||
#if 0 //soc
|
||||
#if 0 // soc
|
||||
QImage *qimg;
|
||||
QImage newMap(filePath.c_str());
|
||||
if (newMap.isNull()) {
|
||||
@@ -402,7 +402,7 @@ void Canvas::loadMap(const char *iFileName,
|
||||
GaussianPyramid *pyramid = new GaussianPyramid(tmp, iNbLevels, iSigma);
|
||||
int ow = pyramid->width(0);
|
||||
int oh = pyramid->height(0);
|
||||
string base(iMapName); //soc
|
||||
string base(iMapName); // soc
|
||||
for (int i = 0; i < pyramid->getNumberOfLevels(); ++i) {
|
||||
// save each image:
|
||||
#if 0
|
||||
@@ -410,19 +410,19 @@ void Canvas::loadMap(const char *iFileName,
|
||||
h = pyramid.height(i);
|
||||
#endif
|
||||
|
||||
//soc QImage qtmp(ow, oh, QImage::Format_RGB32);
|
||||
// soc QImage qtmp(ow, oh, QImage::Format_RGB32);
|
||||
ImBuf *qtmp = IMB_allocImBuf(ow, oh, 32, IB_rect);
|
||||
|
||||
//int k = (1 << i);
|
||||
// int k = (1 << i);
|
||||
for (y = 0; y < oh; ++y) {
|
||||
for (x = 0; x < ow; ++x) {
|
||||
int c = pyramid->pixel(x, y, i); // 255 * pyramid->pixel(x, y, i);
|
||||
//soc qtmp.setPixel(x, y, qRgb(c, c, c));
|
||||
// soc qtmp.setPixel(x, y, qRgb(c, c, c));
|
||||
pix = (char *)qtmp->rect + y * rowbytes + x * 4;
|
||||
pix[0] = pix[1] = pix[2] = c;
|
||||
}
|
||||
}
|
||||
//soc qtmp.save(base + QString::number(i) + ".bmp", "BMP");
|
||||
// soc qtmp.save(base + QString::number(i) + ".bmp", "BMP");
|
||||
stringstream filename;
|
||||
filename << base;
|
||||
filename << i << ".bmp";
|
||||
@@ -443,7 +443,7 @@ void Canvas::loadMap(const char *iFileName,
|
||||
#endif
|
||||
|
||||
_maps[iMapName] = pyramid;
|
||||
//newMap->save("toto.bmp", "BMP");
|
||||
// newMap->save("toto.bmp", "BMP");
|
||||
}
|
||||
|
||||
float Canvas::readMapPixel(const char *iMapName, int level, int x, int y)
|
||||
|
||||
@@ -137,8 +137,8 @@ class Canvas {
|
||||
}
|
||||
|
||||
/* Maps management */
|
||||
/*! Loads an image map. The map will be scaled (without preserving the ratio in order to fit the actual
|
||||
* canvas size.).
|
||||
/*! Loads an image map. The map will be scaled
|
||||
* (without preserving the ratio in order to fit the actual canvas size.).
|
||||
* The image must be a gray values image...
|
||||
* \param iFileName:
|
||||
* The name of the image file
|
||||
@@ -160,9 +160,11 @@ class Canvas {
|
||||
* \param level:
|
||||
* The level of the pyramid from which the pixel must be read.
|
||||
* \param x:
|
||||
* The abscissa of the desired pixel specified in level0 coordinate system. The origin is the lower left corner.
|
||||
* The abscissa of the desired pixel specified in level0 coordinate system.
|
||||
* The origin is the lower left corner.
|
||||
* \param y:
|
||||
* The ordinate of the desired pixel specified in level0 coordinate system. The origin is the lower left corner.
|
||||
* The ordinate of the desired pixel specified in level0 coordinate system.
|
||||
* The origin is the lower left corner.
|
||||
*/
|
||||
float readMapPixel(const char *iMapName, int level, int x, int y);
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ void Chain::push_viewedge_back(ViewEdge *iViewEdge, bool orientation)
|
||||
} while ((v != vend) && (v != vfirst));
|
||||
|
||||
if (v == vfirst) {
|
||||
//Add last one:
|
||||
// Add last one:
|
||||
current = (*v)->point2d();
|
||||
Curve::push_vertex_back(*v);
|
||||
//_Length += (current - previous).norm();
|
||||
@@ -138,7 +138,7 @@ void Chain::push_viewedge_front(ViewEdge *iViewEdge, bool orientation)
|
||||
} while ((v != vend) && (v != vfirst));
|
||||
|
||||
if (v == vfirst) {
|
||||
//Add last one:
|
||||
// Add last one:
|
||||
current = (*v)->point2d();
|
||||
Curve::push_vertex_front(*v);
|
||||
//_Length += (current - previous).norm();
|
||||
|
||||
@@ -143,10 +143,11 @@ int ChainSilhouetteIterator::traverse(const AdjacencyIterator &ait)
|
||||
return 0;
|
||||
}
|
||||
if (nextVertex->getNature() & Nature::NON_T_VERTEX) {
|
||||
//soc NonTVertex *nontvertex = (NonTVertex*)nextVertex;
|
||||
// soc NonTVertex *nontvertex = (NonTVertex*)nextVertex;
|
||||
ViewEdge *newEdge(0);
|
||||
// we'll try to chain the edges by keeping the same nature...
|
||||
// the preseance order is : SILHOUETTE, BORDER, CREASE, MATERIAL_BOUNDARY, EDGE_MARK, SUGGESTIVE, VALLEY, RIDGE
|
||||
// the preseance order is : SILHOUETTE, BORDER, CREASE, MATERIAL_BOUNDARY, EDGE_MARK,
|
||||
// SUGGESTIVE, VALLEY, RIDGE
|
||||
Nature::EdgeNature natures[8] = {
|
||||
Nature::SILHOUETTE,
|
||||
Nature::BORDER,
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
#include "../view_map/ViewMapIterators.h"
|
||||
#include "../view_map/ViewMapAdvancedIterators.h"
|
||||
|
||||
//using namespace ViewEdgeInternal;
|
||||
// using namespace ViewEdgeInternal;
|
||||
|
||||
namespace Freestyle {
|
||||
|
||||
@@ -98,7 +98,8 @@ class AdjacencyIterator : public Iterator {
|
||||
return _internalIterator.isBegin();
|
||||
}
|
||||
|
||||
/*! Returns true if the current ViewEdge is coming towards the iteration vertex. False otherwise. */
|
||||
/*! Returns true if the current ViewEdge is coming towards the iteration vertex. False otherwise.
|
||||
*/
|
||||
bool isIncoming() const;
|
||||
|
||||
/*! Returns a *pointer* to the pointed ViewEdge. */
|
||||
@@ -144,14 +145,15 @@ class AdjacencyIterator : public Iterator {
|
||||
* It makes the works of chaining rules description easier.
|
||||
* The two main methods that need to overloaded are traverse() and init().
|
||||
* traverse() tells which ViewEdge to follow, among the adjacent ones.
|
||||
* If you specify restriction rules (such as "Chain only ViewEdges of the selection"), they will be included
|
||||
* in the adjacency iterator. (i.e, the adjacent iterator will only stop on "valid" edges).
|
||||
* If you specify restriction rules (such as "Chain only ViewEdges of the selection"), they will
|
||||
* be included in the adjacency iterator. (i.e, the adjacent iterator will only stop on "valid"
|
||||
* edges).
|
||||
*/
|
||||
class ChainingIterator : public ViewEdgeInternal::ViewEdgeIterator {
|
||||
protected:
|
||||
bool _restrictToSelection;
|
||||
bool _restrictToUnvisited;
|
||||
bool _increment; //true if we're currently incrementing, false when decrementing
|
||||
bool _increment; // true if we're currently incrementing, false when decrementing
|
||||
|
||||
public:
|
||||
ViewEdge *result;
|
||||
@@ -159,13 +161,11 @@ class ChainingIterator : public ViewEdgeInternal::ViewEdgeIterator {
|
||||
|
||||
/*! Builds a Chaining Iterator from the first ViewEdge used for iteration and its orientation.
|
||||
* \param iRestrictToSelection:
|
||||
* Indicates whether to force the chaining to stay within the set of selected ViewEdges or not.
|
||||
* \param iRestrictToUnvisited:
|
||||
* Indicates whether a ViewEdge that has already been chained must be ignored ot not.
|
||||
* \param begin:
|
||||
* The ViewEdge from which to start the chain.
|
||||
* \param orientation:
|
||||
* The direction to follow to explore the graph. If true, the direction indicated by the first ViewEdge is used.
|
||||
* Indicates whether to force the chaining to stay within the set of selected ViewEdges or
|
||||
* not. \param iRestrictToUnvisited: Indicates whether a ViewEdge that has already been chained
|
||||
* must be ignored ot not. \param begin: The ViewEdge from which to start the chain. \param
|
||||
* orientation: The direction to follow to explore the graph. If true, the direction indicated by
|
||||
* the first ViewEdge is used.
|
||||
*/
|
||||
ChainingIterator(bool iRestrictToSelection = true,
|
||||
bool iRestrictToUnvisited = true,
|
||||
@@ -200,17 +200,19 @@ class ChainingIterator : public ViewEdgeInternal::ViewEdgeIterator {
|
||||
*/
|
||||
virtual int init();
|
||||
|
||||
/*! This method iterates over the potential next ViewEdges and returns the one that will be followed next.
|
||||
* returns the next ViewEdge to follow or 0 when the end of the chain is reached.
|
||||
/*! This method iterates over the potential next ViewEdges and returns the one that will be
|
||||
* followed next. returns the next ViewEdge to follow or 0 when the end of the chain is reached.
|
||||
* \param it:
|
||||
* The iterator over the ViewEdges adjacent to the end vertex of the current ViewEdge.
|
||||
* The Adjacency iterator reflects the restriction rules by only iterating over the valid ViewEdges.
|
||||
* The Adjacency iterator reflects the restriction rules by only iterating over the valid
|
||||
* ViewEdges.
|
||||
*/
|
||||
virtual int traverse(const AdjacencyIterator &it);
|
||||
|
||||
/* accessors */
|
||||
/*! Returns true if the orientation of the current ViewEdge corresponds to its natural orientation */
|
||||
//inline bool getOrientation() const {}
|
||||
/*! Returns true if the orientation of the current ViewEdge corresponds to its natural
|
||||
* orientation */
|
||||
// inline bool getOrientation() const {}
|
||||
|
||||
/*! Returns the vertex which is the next crossing */
|
||||
inline ViewVertex *getVertex()
|
||||
@@ -251,20 +253,18 @@ class ChainingIterator : public ViewEdgeInternal::ViewEdgeIterator {
|
||||
|
||||
/*! A ViewEdge Iterator used to follow ViewEdges the most naturally.
|
||||
* For example, it will follow visible ViewEdges of same nature.
|
||||
* As soon, as the nature or the visibility changes, the iteration stops (by setting the pointed ViewEdge to 0).
|
||||
* In the case of an iteration over a set of ViewEdge that are both Silhouette and Crease, there will be a precedence
|
||||
* of the silhouette over the crease criterion.
|
||||
* As soon, as the nature or the visibility changes, the iteration stops (by setting the pointed
|
||||
* ViewEdge to 0). In the case of an iteration over a set of ViewEdge that are both Silhouette and
|
||||
* Crease, there will be a precedence of the silhouette over the crease criterion.
|
||||
*/
|
||||
class ChainSilhouetteIterator : public ChainingIterator {
|
||||
public:
|
||||
/*! Builds a ChainSilhouetteIterator from the first ViewEdge used for iteration and its orientation.
|
||||
* \param iRestrictToSelection:
|
||||
* Indicates whether to force the chaining to stay within the set of selected ViewEdges or not.
|
||||
* \param begin:
|
||||
* The ViewEdge from where to start the iteration.
|
||||
* \param orientation:
|
||||
* If true, we'll look for the next ViewEdge among the ViewEdges that surround the ending ViewVertex of begin.
|
||||
* If false, we'll search over the ViewEdges surrounding the ending ViewVertex of begin.
|
||||
/*! Builds a ChainSilhouetteIterator from the first ViewEdge used for iteration and its
|
||||
* orientation. \param iRestrictToSelection: Indicates whether to force the chaining to stay
|
||||
* within the set of selected ViewEdges or not. \param begin: The ViewEdge from where to start
|
||||
* the iteration. \param orientation: If true, we'll look for the next ViewEdge among the
|
||||
* ViewEdges that surround the ending ViewVertex of begin. If false, we'll search over the
|
||||
* ViewEdges surrounding the ending ViewVertex of begin.
|
||||
*/
|
||||
ChainSilhouetteIterator(bool iRestrictToSelection = true,
|
||||
ViewEdge *begin = NULL,
|
||||
@@ -284,8 +284,8 @@ class ChainSilhouetteIterator : public ChainingIterator {
|
||||
return "ChainSilhouetteIterator";
|
||||
}
|
||||
|
||||
/*! This method iterates over the potential next ViewEdges and returns the one that will be followed next.
|
||||
* When reaching the end of a chain, 0 is returned.
|
||||
/*! This method iterates over the potential next ViewEdges and returns the one that will be
|
||||
* followed next. When reaching the end of a chain, 0 is returned.
|
||||
*/
|
||||
virtual int traverse(const AdjacencyIterator &it);
|
||||
|
||||
@@ -301,13 +301,13 @@ class ChainSilhouetteIterator : public ChainingIterator {
|
||||
//
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
/*! A "generic" user-controlled ViewEdge iterator. This iterator is in particular built from a unary predicate and
|
||||
* a binary predicate.
|
||||
* First, the unary predicate is evaluated for all potential next ViewEdges in order to only keep the ones respecting
|
||||
* a certain constraint.
|
||||
* Then, the binary predicate is evaluated on the current ViewEdge together with each ViewEdge of the previous
|
||||
* selection. The first ViewEdge respecting both the unary predicate and the binary predicate is kept as the next one.
|
||||
* If none of the potential next ViewEdge respects these 2 predicates, 0 is returned.
|
||||
/*! A "generic" user-controlled ViewEdge iterator. This iterator is in particular built from a
|
||||
* unary predicate and a binary predicate. First, the unary predicate is evaluated for all
|
||||
* potential next ViewEdges in order to only keep the ones respecting a certain constraint. Then,
|
||||
* the binary predicate is evaluated on the current ViewEdge together with each ViewEdge of the
|
||||
* previous selection. The first ViewEdge respecting both the unary predicate and the binary
|
||||
* predicate is kept as the next one. If none of the potential next ViewEdge respects these 2
|
||||
* predicates, 0 is returned.
|
||||
*/
|
||||
class ChainPredicateIterator : public ChainingIterator {
|
||||
protected:
|
||||
@@ -318,14 +318,12 @@ class ChainPredicateIterator : public ChainingIterator {
|
||||
public:
|
||||
/*! Builds a ChainPredicateIterator from a starting ViewEdge and its orientation.
|
||||
* \param iRestrictToSelection:
|
||||
* Indicates whether to force the chaining to stay within the set of selected ViewEdges or not.
|
||||
* \param iRestrictToUnvisited:
|
||||
* Indicates whether a ViewEdge that has already been chained must be ignored ot not.
|
||||
* \param begin:
|
||||
* The ViewEdge from where to start the iteration.
|
||||
* \param orientation:
|
||||
* If true, we'll look for the next ViewEdge among the ViewEdges that surround the ending ViewVertex of begin.
|
||||
* If false, we'll search over the ViewEdges surrounding the ending ViewVertex of begin.
|
||||
* Indicates whether to force the chaining to stay within the set of selected ViewEdges or
|
||||
* not. \param iRestrictToUnvisited: Indicates whether a ViewEdge that has already been chained
|
||||
* must be ignored ot not. \param begin: The ViewEdge from where to start the iteration. \param
|
||||
* orientation: If true, we'll look for the next ViewEdge among the ViewEdges that surround the
|
||||
* ending ViewVertex of begin. If false, we'll search over the ViewEdges surrounding the ending
|
||||
* ViewVertex of begin.
|
||||
*/
|
||||
ChainPredicateIterator(bool iRestrictToSelection = true,
|
||||
bool iRestrictToUnvisited = true,
|
||||
@@ -337,21 +335,18 @@ class ChainPredicateIterator : public ChainingIterator {
|
||||
_unary_predicate = 0;
|
||||
}
|
||||
|
||||
/*! Builds a ChainPredicateIterator from a unary predicate, a binary predicate, a starting ViewEdge and
|
||||
* its orientation.
|
||||
* \param iRestrictToSelection:
|
||||
* Indicates whether to force the chaining to stay within the set of selected ViewEdges or not.
|
||||
* \param iRestrictToUnvisited:
|
||||
/*! Builds a ChainPredicateIterator from a unary predicate, a binary predicate, a starting
|
||||
* ViewEdge and its orientation. \param iRestrictToSelection: Indicates whether to force the
|
||||
* chaining to stay within the set of selected ViewEdges or not. \param iRestrictToUnvisited:
|
||||
* Indicates whether a ViewEdge that has already been chained must be ignored ot not.
|
||||
* \param upred:
|
||||
* The unary predicate that the next ViewEdge must satisfy.
|
||||
* \param bpred:
|
||||
* The binary predicate that the next ViewEdge must satisfy together with the actual pointed ViewEdge.
|
||||
* \param begin:
|
||||
* The ViewEdge from where to start the iteration.
|
||||
* \param orientation:
|
||||
* If true, we'll look for the next ViewEdge among the ViewEdges that surround the ending ViewVertex of begin.
|
||||
* If false, we'll search over the ViewEdges surrounding the ending ViewVertex of begin.
|
||||
* The binary predicate that the next ViewEdge must satisfy together with the actual pointed
|
||||
* ViewEdge. \param begin: The ViewEdge from where to start the iteration. \param orientation: If
|
||||
* true, we'll look for the next ViewEdge among the ViewEdges that surround the ending ViewVertex
|
||||
* of begin. If false, we'll search over the ViewEdges surrounding the ending ViewVertex of
|
||||
* begin.
|
||||
*/
|
||||
ChainPredicateIterator(UnaryPredicate1D &upred,
|
||||
BinaryPredicate1D &bpred,
|
||||
@@ -385,8 +380,8 @@ class ChainPredicateIterator : public ChainingIterator {
|
||||
return "ChainPredicateIterator";
|
||||
}
|
||||
|
||||
/*! This method iterates over the potential next ViewEdges and returns the one that will be followed next.
|
||||
* When reaching the end of a chain, 0 is returned.
|
||||
/*! This method iterates over the potential next ViewEdges and returns the one that will be
|
||||
* followed next. When reaching the end of a chain, 0 is returned.
|
||||
*/
|
||||
virtual int traverse(const AdjacencyIterator &it);
|
||||
|
||||
|
||||
@@ -527,7 +527,7 @@ Curve::point_iterator Curve::points_begin(float step)
|
||||
++second;
|
||||
return point_iterator(
|
||||
_Vertices.begin(), second, _Vertices.begin(), _Vertices.end(), _nSegments, step, 0.0f, 0.0f);
|
||||
//return point_iterator(_Vertices.begin(), second, _nSegments, step, 0.0f, 0.0f);
|
||||
// return point_iterator(_Vertices.begin(), second, _nSegments, step, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
Curve::const_point_iterator Curve::points_begin(float step) const
|
||||
@@ -536,7 +536,7 @@ Curve::const_point_iterator Curve::points_begin(float step) const
|
||||
++second;
|
||||
return const_point_iterator(
|
||||
_Vertices.begin(), second, _Vertices.begin(), _Vertices.end(), _nSegments, step, 0.0f, 0.0f);
|
||||
//return const_point_iterator(_Vertices.begin(), second, _nSegments, step, 0.0f, 0.0f);
|
||||
// return const_point_iterator(_Vertices.begin(), second, _nSegments, step, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
Curve::point_iterator Curve::points_end(float step)
|
||||
@@ -549,7 +549,7 @@ Curve::point_iterator Curve::points_end(float step)
|
||||
step,
|
||||
1.0f,
|
||||
_Length);
|
||||
//return point_iterator(_Vertices.end(), _Vertices.end(), _nSegments, step, 1.0f, _Length);
|
||||
// return point_iterator(_Vertices.end(), _Vertices.end(), _nSegments, step, 1.0f, _Length);
|
||||
}
|
||||
|
||||
Curve::const_point_iterator Curve::points_end(float step) const
|
||||
@@ -562,7 +562,8 @@ Curve::const_point_iterator Curve::points_end(float step) const
|
||||
step,
|
||||
1.0f,
|
||||
_Length);
|
||||
//return const_point_iterator(_Vertices.end(), _Vertices.end(), _nSegments, step, 1.0f, _Length);
|
||||
// return const_point_iterator(_Vertices.end(), _Vertices.end(), _nSegments, step, 1.0f,
|
||||
// _Length);
|
||||
}
|
||||
|
||||
// Adavnced Iterators access
|
||||
|
||||
@@ -55,10 +55,10 @@ using namespace Geometry;
|
||||
|
||||
/*! Class to represent a point of a curve.
|
||||
* A CurvePoint can be any point of a 1D curve (it doesn't have to be a vertex of the curve).
|
||||
* Any Interface1D is built upon ViewEdges, themselves built upon FEdges. Therefore, a curve is basically
|
||||
* a polyline made of a list SVertex.
|
||||
* Thus, a CurvePoint is built by lineraly interpolating two SVertex.
|
||||
* CurvePoint can be used as virtual points while querying 0D information along a curve at a given resolution.
|
||||
* Any Interface1D is built upon ViewEdges, themselves built upon FEdges. Therefore, a curve is
|
||||
* basically a polyline made of a list SVertex. Thus, a CurvePoint is built by lineraly
|
||||
* interpolating two SVertex. CurvePoint can be used as virtual points while querying 0D
|
||||
* information along a curve at a given resolution.
|
||||
*/
|
||||
class CurvePoint : public Interface0D {
|
||||
public: // Implementation of Interface0D
|
||||
@@ -188,7 +188,7 @@ class CurvePoint : public Interface0D {
|
||||
SVertex *__A;
|
||||
SVertex *__B;
|
||||
float _t2d;
|
||||
//float _t3d;
|
||||
// float _t3d;
|
||||
Vec3r _Point2d;
|
||||
Vec3r _Point3d;
|
||||
|
||||
@@ -216,7 +216,7 @@ class CurvePoint : public Interface0D {
|
||||
*/
|
||||
CurvePoint(CurvePoint *iA, CurvePoint *iB, float t2d);
|
||||
|
||||
//CurvePoint(SVertex *iA, SVertex *iB, float t2d, float t3d);
|
||||
// CurvePoint(SVertex *iA, SVertex *iB, float t2d, float t3d);
|
||||
|
||||
/*! Copy Constructor. */
|
||||
CurvePoint(const CurvePoint &iBrother);
|
||||
@@ -302,12 +302,12 @@ class CurvePoint : public Interface0D {
|
||||
}
|
||||
|
||||
Vec3r normal() const;
|
||||
//FrsMaterial material() const;
|
||||
//Id shape_id() const;
|
||||
// FrsMaterial material() const;
|
||||
// Id shape_id() const;
|
||||
const SShape *shape() const;
|
||||
//float shape_importance() const;
|
||||
// float shape_importance() const;
|
||||
|
||||
//const unsigned qi() const;
|
||||
// const unsigned qi() const;
|
||||
occluder_container::const_iterator occluders_begin() const;
|
||||
occluder_container::const_iterator occluders_end() const;
|
||||
bool occluders_empty() const;
|
||||
@@ -564,25 +564,25 @@ class Curve : public Interface1D {
|
||||
CurveInternal::CurvePointIterator curveVerticesEnd();
|
||||
|
||||
// Iterators access
|
||||
/*! Returns an Interface0DIterator pointing onto the first vertex of the Curve and that can iterate
|
||||
* over the \a vertices of the Curve.
|
||||
/*! Returns an Interface0DIterator pointing onto the first vertex of the Curve and that can
|
||||
* iterate over the \a vertices of the Curve.
|
||||
*/
|
||||
virtual Interface0DIterator verticesBegin();
|
||||
|
||||
/*! Returns an Interface0DIterator pointing after the last vertex of the Curve and that can iterate
|
||||
* over the \a vertices of the Curve.
|
||||
/*! Returns an Interface0DIterator pointing after the last vertex of the Curve and that can
|
||||
* iterate over the \a vertices of the Curve.
|
||||
*/
|
||||
virtual Interface0DIterator verticesEnd();
|
||||
|
||||
/*! Returns an Interface0DIterator pointing onto the first point of the Curve and that can iterate
|
||||
* over the \a points of the Curve at any resolution.
|
||||
* At each iteration a virtual temporary CurvePoint is created.
|
||||
/*! Returns an Interface0DIterator pointing onto the first point of the Curve and that can
|
||||
* iterate over the \a points of the Curve at any resolution. At each iteration a virtual
|
||||
* temporary CurvePoint is created.
|
||||
*/
|
||||
virtual Interface0DIterator pointsBegin(float t = 0.0f);
|
||||
|
||||
/*! Returns an Interface0DIterator pointing after the last point of the Curve and that can iterate
|
||||
* over the \a points of the Curve at any resolution.
|
||||
* At each iteration a virtual temporary CurvePoint is created.
|
||||
/*! Returns an Interface0DIterator pointing after the last point of the Curve and that can
|
||||
* iterate over the \a points of the Curve at any resolution. At each iteration a virtual
|
||||
* temporary CurvePoint is created.
|
||||
*/
|
||||
virtual Interface0DIterator pointsEnd(float t = 0.0f);
|
||||
|
||||
|
||||
@@ -50,8 +50,8 @@ class CurvePoint_nonconst_traits : public Nonconst_traits<CurvePoint *> {
|
||||
/* */
|
||||
/**********************************/
|
||||
|
||||
/*! iterator on a curve. Allows an iterating outside initial vertices. A CurvePoint is instanciated an returned
|
||||
* when the iterator is dereferenced.
|
||||
/*! iterator on a curve. Allows an iterating outside initial vertices. A CurvePoint is
|
||||
* instanciated an returned when the iterator is dereferenced.
|
||||
*/
|
||||
template<class Traits>
|
||||
class __point_iterator : public IteratorBase<Traits, BidirectionalIteratorTag_Traits> {
|
||||
@@ -86,7 +86,7 @@ class __point_iterator : public IteratorBase<Traits, BidirectionalIteratorTag_Tr
|
||||
friend class __point_iterator<CurvePoint_nonconst_traits>;
|
||||
friend class iterator;
|
||||
#endif
|
||||
//protected:
|
||||
// protected:
|
||||
public:
|
||||
float _CurvilinearLength;
|
||||
float _step;
|
||||
@@ -169,7 +169,7 @@ class __point_iterator : public IteratorBase<Traits, BidirectionalIteratorTag_Tr
|
||||
delete _Point;
|
||||
}
|
||||
|
||||
//protected: //FIXME
|
||||
// protected: //FIXME
|
||||
public:
|
||||
inline __point_iterator(vertex_container_iterator iA,
|
||||
vertex_container_iterator iB,
|
||||
@@ -307,7 +307,7 @@ class __point_iterator : public IteratorBase<Traits, BidirectionalIteratorTag_Tr
|
||||
else {
|
||||
_t = 1.0f; // AB is a null segment, we're directly at its end
|
||||
}
|
||||
//if normAB ~= 0, we don't change these values
|
||||
// if normAB ~= 0, we don't change these values
|
||||
if (_t >= 1) {
|
||||
_CurvilinearLength -= normAB * (_t - 1);
|
||||
if (_currentn == _n - 1) {
|
||||
|
||||
@@ -187,7 +187,7 @@ class CurvePointIterator : public Interface0DIteratorNested {
|
||||
return false;
|
||||
}
|
||||
|
||||
//protected:
|
||||
// protected:
|
||||
virtual int increment()
|
||||
{
|
||||
if ((_currentn == _n - 1) && (_t == 1.0f)) {
|
||||
@@ -223,7 +223,7 @@ class CurvePointIterator : public Interface0DIteratorNested {
|
||||
else {
|
||||
_t = 1.0f; // AB is a null segment, we're directly at its end
|
||||
}
|
||||
//if normAB ~= 0, we don't change these values
|
||||
// if normAB ~= 0, we don't change these values
|
||||
if (_t >= 1) {
|
||||
_CurvilinearLength -= normAB * (_t - 1);
|
||||
if (_currentn == _n - 1) {
|
||||
@@ -241,7 +241,7 @@ class CurvePointIterator : public Interface0DIteratorNested {
|
||||
|
||||
virtual int decrement()
|
||||
{
|
||||
if (_t == 0.0f) { //we're at the beginning of the edge
|
||||
if (_t == 0.0f) { // we're at the beginning of the edge
|
||||
_t = 1.0f;
|
||||
--_currentn;
|
||||
--__A;
|
||||
|
||||
@@ -278,7 +278,7 @@ void Operators::bidirectionalChain(ViewEdgeIterator &it, UnaryPredicate1D &pred)
|
||||
|
||||
Chain *new_chain = new Chain(id);
|
||||
++id;
|
||||
# if 0 //FIXME
|
||||
# if 0 // FIXME
|
||||
ViewEdgeIterator it_back(it);
|
||||
--it_back;
|
||||
# endif
|
||||
@@ -841,7 +841,7 @@ static int __recursiveSplit(Chain *_curve,
|
||||
real _min = FLT_MAX;
|
||||
++it;
|
||||
real mean = 0.f;
|
||||
//soc unused - real variance = 0.0f;
|
||||
// soc unused - real variance = 0.0f;
|
||||
unsigned count = 0;
|
||||
CurveInternal::CurvePointIterator next = it;
|
||||
++next;
|
||||
@@ -865,7 +865,7 @@ static int __recursiveSplit(Chain *_curve,
|
||||
}
|
||||
mean /= (float)count;
|
||||
|
||||
//if ((!bsplit) || (mean - _min > mean)) { // we didn't find any minimum
|
||||
// if ((!bsplit) || (mean - _min > mean)) { // we didn't find any minimum
|
||||
if (!bsplit) { // we didn't find any minimum
|
||||
newChains.push_back(_curve);
|
||||
return 0;
|
||||
@@ -1210,7 +1210,7 @@ inline int applyShading(Stroke &stroke, vector<StrokeShader *> &shaders)
|
||||
|
||||
int Operators::create(UnaryPredicate1D &pred, vector<StrokeShader *> shaders)
|
||||
{
|
||||
//Canvas* canvas = Canvas::getInstance();
|
||||
// Canvas* canvas = Canvas::getInstance();
|
||||
if (!_current_set) {
|
||||
cerr << "Warning: current set empty" << endl;
|
||||
return 0;
|
||||
@@ -1229,7 +1229,7 @@ int Operators::create(UnaryPredicate1D &pred, vector<StrokeShader *> shaders)
|
||||
delete stroke;
|
||||
goto error;
|
||||
}
|
||||
//canvas->RenderStroke(stroke);
|
||||
// canvas->RenderStroke(stroke);
|
||||
new_strokes_set.push_back(stroke);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,8 +43,9 @@
|
||||
namespace Freestyle {
|
||||
|
||||
/*! Class defining the operators used in a style module.
|
||||
* There are 4 classes of operators: Selection, Chaining, Splitting and Creating. All these operators are
|
||||
* user controlled in the scripting language through Functors, Predicates and Shaders that are taken as arguments.
|
||||
* There are 4 classes of operators: Selection, Chaining, Splitting and Creating. All these
|
||||
* operators are user controlled in the scripting language through Functors, Predicates and Shaders
|
||||
* that are taken as arguments.
|
||||
*/
|
||||
class Operators {
|
||||
|
||||
@@ -63,146 +64,127 @@ class Operators {
|
||||
static int select(UnaryPredicate1D &pred);
|
||||
|
||||
/*! Builds a set of chains from the current set of ViewEdges.
|
||||
* Each ViewEdge of the current list starts a new chain. The chaining operator then iterates over the ViewEdges
|
||||
* of the ViewMap using the user specified iterator.
|
||||
* This operator only iterates using the increment operator and is therefore unidirectional.
|
||||
* \param it:
|
||||
* The iterator on the ViewEdges of the ViewMap. It contains the chaining rule.
|
||||
* \param pred:
|
||||
* The predicate on the ViewEdge that expresses the stopping condition.
|
||||
* \param modifier:
|
||||
* A function that takes a ViewEdge as argument and that is used to modify the processed ViewEdge
|
||||
* state (the timestamp incrementation is a typical illustration of such a modifier)
|
||||
* Each ViewEdge of the current list starts a new chain. The chaining operator then iterates
|
||||
* over the ViewEdges of the ViewMap using the user specified iterator. This operator only
|
||||
* iterates using the increment operator and is therefore unidirectional. \param it: The iterator
|
||||
* on the ViewEdges of the ViewMap. It contains the chaining rule. \param pred: The predicate on
|
||||
* the ViewEdge that expresses the stopping condition. \param modifier: A function that takes a
|
||||
* ViewEdge as argument and that is used to modify the processed ViewEdge state (the timestamp
|
||||
* incrementation is a typical illustration of such a modifier)
|
||||
*/
|
||||
static int chain(ViewEdgeInternal::ViewEdgeIterator &it,
|
||||
UnaryPredicate1D &pred,
|
||||
UnaryFunction1D_void &modifier);
|
||||
|
||||
/*! Builds a set of chains from the current set of ViewEdges.
|
||||
* Each ViewEdge of the current list starts a new chain. The chaining operator then iterates over the ViewEdges
|
||||
* of the ViewMap using the user specified iterator.
|
||||
* This operator only iterates using the increment operator and is therefore unidirectional.
|
||||
* This chaining operator is different from the previous one because it doesn't take any modifier as argument.
|
||||
* Indeed, the time stamp (insuring that a ViewEdge is processed one time) is automatically managed in this case.
|
||||
* \param it:
|
||||
* The iterator on the ViewEdges of the ViewMap. It contains the chaining rule.
|
||||
* \param pred:
|
||||
* The predicate on the ViewEdge that expresses the stopping condition.
|
||||
* Each ViewEdge of the current list starts a new chain. The chaining operator then iterates
|
||||
* over the ViewEdges of the ViewMap using the user specified iterator. This operator only
|
||||
* iterates using the increment operator and is therefore unidirectional. This chaining operator
|
||||
* is different from the previous one because it doesn't take any modifier as argument. Indeed,
|
||||
* the time stamp (insuring that a ViewEdge is processed one time) is automatically managed in
|
||||
* this case. \param it: The iterator on the ViewEdges of the ViewMap. It contains the chaining
|
||||
* rule. \param pred: The predicate on the ViewEdge that expresses the stopping condition.
|
||||
*/
|
||||
static int chain(ViewEdgeInternal::ViewEdgeIterator &it, UnaryPredicate1D &pred);
|
||||
|
||||
/*! Builds a set of chains from the current set of ViewEdges.
|
||||
* Each ViewEdge of the current list potentially starts a new chain. The chaining operator then iterates over
|
||||
* the ViewEdges of the ViewMap using the user specified iterator.
|
||||
* This operator iterates both using the increment and decrement operators and is therefore bidirectional.
|
||||
* This operator works with a ChainingIterator which contains the chaining rules. It is this last one which can
|
||||
* be told to chain only edges that belong to the selection or not to process twice a ViewEdge during the chaining.
|
||||
* Each time a ViewEdge is added to a chain, its chaining time stamp is incremented. This allows you to keep track
|
||||
* of the number of chains to which a ViewEdge belongs to.
|
||||
* \param it:
|
||||
* The ChainingIterator on the ViewEdges of the ViewMap. It contains the chaining rule.
|
||||
* \param pred:
|
||||
* The predicate on the ViewEdge that expresses the stopping condition.
|
||||
* Each ViewEdge of the current list potentially starts a new chain. The chaining operator then
|
||||
* iterates over the ViewEdges of the ViewMap using the user specified iterator. This operator
|
||||
* iterates both using the increment and decrement operators and is therefore bidirectional. This
|
||||
* operator works with a ChainingIterator which contains the chaining rules. It is this last one
|
||||
* which can be told to chain only edges that belong to the selection or not to process twice a
|
||||
* ViewEdge during the chaining. Each time a ViewEdge is added to a chain, its chaining time
|
||||
* stamp is incremented. This allows you to keep track of the number of chains to which a
|
||||
* ViewEdge belongs to. \param it: The ChainingIterator on the ViewEdges of the ViewMap. It
|
||||
* contains the chaining rule. \param pred: The predicate on the ViewEdge that expresses the
|
||||
* stopping condition.
|
||||
*/
|
||||
static int bidirectionalChain(ChainingIterator &it, UnaryPredicate1D &pred);
|
||||
|
||||
/*! The only difference with the above bidirectional chaining algorithm is that we don't need to pass a stopping
|
||||
* criterion. This might be desirable when the stopping criterion is already contained in the iterator definition.
|
||||
* Builds a set of chains from the current set of ViewEdges.
|
||||
* Each ViewEdge of the current list potentially starts a new chain. The chaining operator then iterates over
|
||||
* the ViewEdges of the ViewMap using the user specified iterator.
|
||||
* This operator iterates both using the increment and decrement operators and is therefore bidirectional.
|
||||
* This operator works with a ChainingIterator which contains the chaining rules. It is this last one which can be
|
||||
* told to chain only edges that belong to the selection or not to process twice a ViewEdge during the chaining.
|
||||
* Each time a ViewEdge is added to a chain, its chaining time stamp is incremented. This allows you to keep track
|
||||
* of the number of chains to which a ViewEdge belongs to.
|
||||
* \param it:
|
||||
* The ChainingIterator on the ViewEdges of the ViewMap. It contains the chaining rule.
|
||||
/*! The only difference with the above bidirectional chaining algorithm is that we don't need to
|
||||
* pass a stopping criterion. This might be desirable when the stopping criterion is already
|
||||
* contained in the iterator definition. Builds a set of chains from the current set of
|
||||
* ViewEdges. Each ViewEdge of the current list potentially starts a new chain. The chaining
|
||||
* operator then iterates over the ViewEdges of the ViewMap using the user specified iterator.
|
||||
* This operator iterates both using the increment and decrement operators and is therefore
|
||||
* bidirectional. This operator works with a ChainingIterator which contains the chaining rules.
|
||||
* It is this last one which can be told to chain only edges that belong to the selection or not
|
||||
* to process twice a ViewEdge during the chaining. Each time a ViewEdge is added to a chain, its
|
||||
* chaining time stamp is incremented. This allows you to keep track of the number of chains to
|
||||
* which a ViewEdge belongs to. \param it: The ChainingIterator on the ViewEdges of the ViewMap.
|
||||
* It contains the chaining rule.
|
||||
*/
|
||||
static int bidirectionalChain(ChainingIterator &it);
|
||||
|
||||
/*! Splits each chain of the current set of chains in a sequential way.
|
||||
* The points of each chain are processed (with a specified sampling) sequentially.
|
||||
* Each time a user specified starting condition is verified, a new chain begins and ends as soon as a
|
||||
* user-defined stopping predicate is verified.
|
||||
* This allows chains overlapping rather than chains partitioning.
|
||||
* The first point of the initial chain is the first point of one of the resulting chains.
|
||||
* The splitting ends when no more chain can start.
|
||||
* \param startingPred:
|
||||
* Each time a user specified starting condition is verified, a new chain begins and ends as
|
||||
* soon as a user-defined stopping predicate is verified. This allows chains overlapping rather
|
||||
* than chains partitioning. The first point of the initial chain is the first point of one of
|
||||
* the resulting chains. The splitting ends when no more chain can start. \param startingPred:
|
||||
* The predicate on a point that expresses the starting condition
|
||||
* \param stoppingPred:
|
||||
* The predicate on a point that expresses the stopping condition
|
||||
* \param sampling:
|
||||
* The resolution used to sample the chain for the predicates evaluation. (The chain is not actually
|
||||
* resampled, a virtual point only progresses along the curve using this resolution)
|
||||
* The resolution used to sample the chain for the predicates evaluation. (The chain is
|
||||
* not actually resampled, a virtual point only progresses along the curve using this resolution)
|
||||
*/
|
||||
static int sequentialSplit(UnaryPredicate0D &startingPred,
|
||||
UnaryPredicate0D &stoppingPred,
|
||||
float sampling = 0.0f);
|
||||
|
||||
/*! Splits each chain of the current set of chains in a sequential way.
|
||||
* The points of each chain are processed (with a specified sampling) sequentially and each time a user
|
||||
* specified condition is verified, the chain is split into two chains.
|
||||
* The resulting set of chains is a partition of the initial chain
|
||||
* \param pred:
|
||||
* The predicate on a point that expresses the splitting condition
|
||||
* \param sampling:
|
||||
* The resolution used to sample the chain for the predicate evaluation. (The chain is not actually
|
||||
* resampled, a virtual point only progresses along the curve using this resolution)
|
||||
* The points of each chain are processed (with a specified sampling) sequentially and each time
|
||||
* a user specified condition is verified, the chain is split into two chains. The resulting set
|
||||
* of chains is a partition of the initial chain \param pred: The predicate on a point that
|
||||
* expresses the splitting condition \param sampling: The resolution used to sample the chain for
|
||||
* the predicate evaluation. (The chain is not actually resampled, a virtual point only
|
||||
* progresses along the curve using this resolution)
|
||||
*/
|
||||
static int sequentialSplit(UnaryPredicate0D &pred, float sampling = 0.0f);
|
||||
|
||||
/*! Splits the current set of chains in a recursive way.
|
||||
* We process the points of each chain (with a specified sampling) to find the point minimizing a specified
|
||||
* function. The chain is split in two at this point and the two new chains are processed in the same way.
|
||||
* The recursivity level is controlled through a predicate 1D that expresses a stopping condition
|
||||
* on the chain that is about to be processed.
|
||||
* \param func:
|
||||
* The Unary Function evaluated at each point of the chain.
|
||||
* The splitting point is the point minimizing this function
|
||||
* \param pred:
|
||||
* The Unary Predicate ex pressing the recursivity stopping condition.
|
||||
* This predicate is evaluated for each curve before it actually gets split.
|
||||
* If pred(chain) is true, the curve won't be split anymore.
|
||||
* \param sampling:
|
||||
* The resolution used to sample the chain for the predicates evaluation. (The chain is not actually
|
||||
* resampled, a virtual point only progresses along the curve using this resolution)
|
||||
* We process the points of each chain (with a specified sampling) to find the point minimizing
|
||||
* a specified function. The chain is split in two at this point and the two new chains are
|
||||
* processed in the same way. The recursivity level is controlled through a predicate 1D that
|
||||
* expresses a stopping condition on the chain that is about to be processed. \param func: The
|
||||
* Unary Function evaluated at each point of the chain. The splitting point is the point
|
||||
* minimizing this function \param pred: The Unary Predicate ex pressing the recursivity stopping
|
||||
* condition. This predicate is evaluated for each curve before it actually gets split. If
|
||||
* pred(chain) is true, the curve won't be split anymore. \param sampling: The resolution used to
|
||||
* sample the chain for the predicates evaluation. (The chain is not actually resampled, a
|
||||
* virtual point only progresses along the curve using this resolution)
|
||||
*/
|
||||
static int recursiveSplit(UnaryFunction0D<double> &func,
|
||||
UnaryPredicate1D &pred,
|
||||
float sampling = 0);
|
||||
|
||||
/*! Splits the current set of chains in a recursive way.
|
||||
* We process the points of each chain (with a specified sampling) to find the point minimizing a specified
|
||||
* function. The chain is split in two at this point and the two new chains are processed in the same way.
|
||||
* The user can specify a 0D predicate to make a first selection on the points that can potentially be split.
|
||||
* A point that doesn't verify the 0D predicate won't be candidate in realizing the min.
|
||||
* The recursivity level is controlled through a predicate 1D that expresses a stopping condition
|
||||
* on the chain that is about to be processed.
|
||||
* \param func:
|
||||
* We process the points of each chain (with a specified sampling) to find the point minimizing
|
||||
* a specified function. The chain is split in two at this point and the two new chains are
|
||||
* processed in the same way. The user can specify a 0D predicate to make a first selection on
|
||||
* the points that can potentially be split. A point that doesn't verify the 0D predicate won't
|
||||
* be candidate in realizing the min. The recursivity level is controlled through a predicate 1D
|
||||
* that expresses a stopping condition on the chain that is about to be processed. \param func:
|
||||
* The Unary Function evaluated at each point of the chain.
|
||||
* The splitting point is the point minimizing this function
|
||||
* \param pred0d:
|
||||
* The Unary Predicate 0D used to select the candidate points where the split can occur.
|
||||
* For example, it is very likely that would rather have your chain splitting around its middle point
|
||||
* than around one of its extremities. A 0D predicate working on the curvilinear abscissa allows
|
||||
* to add this kind of constraints.
|
||||
* \param pred:
|
||||
* The Unary Predicate ex pressing the recursivity stopping condition.
|
||||
* This predicate is evaluated for each curve before it actually gets split.
|
||||
* If pred(chain) is true, the curve won't be split anymore.
|
||||
* \param sampling:
|
||||
* The resolution used to sample the chain for the predicates evaluation. (The chain is not actually
|
||||
* resampled, a virtual point only progresses along the curve using this resolution)
|
||||
* The Unary Predicate 0D used to select the candidate points where the split can
|
||||
* occur. For example, it is very likely that would rather have your chain splitting around its
|
||||
* middle point than around one of its extremities. A 0D predicate working on the curvilinear
|
||||
* abscissa allows to add this kind of constraints. \param pred: The Unary Predicate ex pressing
|
||||
* the recursivity stopping condition. This predicate is evaluated for each curve before it
|
||||
* actually gets split. If pred(chain) is true, the curve won't be split anymore. \param
|
||||
* sampling: The resolution used to sample the chain for the predicates evaluation. (The chain is
|
||||
* not actually resampled, a virtual point only progresses along the curve using this resolution)
|
||||
*/
|
||||
static int recursiveSplit(UnaryFunction0D<double> &func,
|
||||
UnaryPredicate0D &pred0d,
|
||||
UnaryPredicate1D &pred,
|
||||
float sampling = 0.0f);
|
||||
|
||||
/*! Sorts the current set of chains (or viewedges) according to the comparison predicate given as argument.
|
||||
* \param pred:
|
||||
* The binary predicate used for the comparison
|
||||
/*! Sorts the current set of chains (or viewedges) according to the comparison predicate given as
|
||||
* argument. \param pred: The binary predicate used for the comparison
|
||||
*/
|
||||
static int sort(BinaryPredicate1D &pred);
|
||||
|
||||
|
||||
@@ -70,8 +70,8 @@ void PSStrokeRenderer::RenderStrokeRepBasic(StrokeRep *iStrokeRep) const
|
||||
svRep[2] = *(v[2]);
|
||||
|
||||
color[0] = svRep[0]->color();
|
||||
//color[1] = svRep[1]->color();
|
||||
//color[2] = svRep[2]->color();
|
||||
// color[1] = svRep[1]->color();
|
||||
// color[2] = svRep[2]->color();
|
||||
|
||||
_ofstream << "newpath" << endl;
|
||||
_ofstream << (color[0])[0] << " " << (color[0])[1] << " " << (color[0])[2] << " setrgbcolor"
|
||||
|
||||
@@ -65,8 +65,8 @@ class UnaryPredicate0D {
|
||||
|
||||
/*! The () operator. Must be overload by inherited classes.
|
||||
* \param it:
|
||||
* The Interface0DIterator pointing onto the Interface0D at which we wish to evaluate the predicate.
|
||||
* \return true if the condition is satisfied, false otherwise.
|
||||
* The Interface0DIterator pointing onto the Interface0D at which we wish to evaluate the
|
||||
* predicate. \return true if the condition is satisfied, false otherwise.
|
||||
*/
|
||||
virtual int operator()(Interface0DIterator &it);
|
||||
|
||||
|
||||
@@ -183,8 +183,8 @@ class FalseUP1D : public UnaryPredicate1D {
|
||||
};
|
||||
|
||||
// QuantitativeInvisibilityUP1D
|
||||
/*! Returns true if the Quantitative Invisibility evaluated at an Interface1D, using the QuantitativeInvisibilityF1D
|
||||
* functor, equals a certain user-defined value.
|
||||
/*! Returns true if the Quantitative Invisibility evaluated at an Interface1D, using the
|
||||
* QuantitativeInvisibilityF1D functor, equals a certain user-defined value.
|
||||
*/
|
||||
class QuantitativeInvisibilityUP1D : public UnaryPredicate1D {
|
||||
public:
|
||||
@@ -344,7 +344,8 @@ class EqualToChainingTimeStampUP1D : public UnaryPredicate1D {
|
||||
};
|
||||
|
||||
// ShapeUP1D
|
||||
/*! Returns true if the shape to which the Interface1D belongs to has the same Id as the one specified by the user. */
|
||||
/*! Returns true if the shape to which the Interface1D belongs to has the same Id as the one
|
||||
* specified by the user. */
|
||||
class ShapeUP1D : public UnaryPredicate1D {
|
||||
private:
|
||||
Id _id;
|
||||
@@ -487,7 +488,8 @@ class FalseBP1D : public BinaryPredicate1D {
|
||||
};
|
||||
|
||||
// Length2DBP1D
|
||||
/*! Returns true if the 2D length of the Interface1D i1 is less than the 2D length of the Interface1D i2. */
|
||||
/*! Returns true if the 2D length of the Interface1D i1 is less than the 2D length of the
|
||||
* Interface1D i2. */
|
||||
class Length2DBP1D : public BinaryPredicate1D {
|
||||
public:
|
||||
/*! Returns the string "Length2DBP1D" */
|
||||
@@ -538,7 +540,8 @@ class SameShapeIdBP1D : public BinaryPredicate1D {
|
||||
};
|
||||
|
||||
// ViewMapGradientNormBP1D
|
||||
/*! Returns true if the evaluation of the Gradient norm Function is higher for Interface1D i1 than for i2. */
|
||||
/*! Returns true if the evaluation of the Gradient norm Function is higher for Interface1D i1 than
|
||||
* for i2. */
|
||||
class ViewMapGradientNormBP1D : public BinaryPredicate1D {
|
||||
private:
|
||||
Functions1D::GetViewMapGradientNormF1D _func;
|
||||
|
||||
@@ -38,7 +38,7 @@ class QInformationMap : public InformationMap {
|
||||
QInformationMap(const QInformationMap &);
|
||||
QInformationMap &operator=(const QInformationMap &);
|
||||
|
||||
//float getSmoothedPixel(int x, int y, float sigma = 0.2f);1
|
||||
// float getSmoothedPixel(int x, int y, float sigma = 0.2f);1
|
||||
virtual float getMean(int x, int y);
|
||||
virtual void retrieveMeanAndVariance(int x, int y, float &oMean, float &oVariance);
|
||||
|
||||
|
||||
@@ -484,7 +484,7 @@ void Stroke::setLength(float iLength)
|
||||
|
||||
float Stroke::ComputeSampling(int iNVertices)
|
||||
{
|
||||
if (iNVertices <= (int)_Vertices.size()) //soc
|
||||
if (iNVertices <= (int)_Vertices.size()) // soc
|
||||
return _sampling;
|
||||
|
||||
float sampling = _Length / (float)(iNVertices - _Vertices.size() + 1);
|
||||
@@ -563,7 +563,7 @@ int Stroke::Resample(int iNPoints)
|
||||
if (s->_resampled == false) {
|
||||
if ((!checkEveryone) && (s->_length < meanlength))
|
||||
continue;
|
||||
//resample
|
||||
// resample
|
||||
s->_n = s->_n + 1;
|
||||
s->_sampling = s->_length / (float)(s->_n + 1);
|
||||
s->_resampled = resampled = true;
|
||||
@@ -577,10 +577,11 @@ int Stroke::Resample(int iNPoints)
|
||||
checkEveryone = true;
|
||||
}
|
||||
if (N < NPointsToAdd) {
|
||||
// fatal error, likely because _Length is inconsistent with the stroke length computed with the vertices
|
||||
// fatal error, likely because _Length is inconsistent with the stroke length computed with the
|
||||
// vertices
|
||||
return -1;
|
||||
}
|
||||
//actually resample:
|
||||
// actually resample:
|
||||
for (vector<StrokeSegment>::iterator s = strokeSegments.begin(), send = strokeSegments.end();
|
||||
s != send;
|
||||
++s) {
|
||||
@@ -617,7 +618,7 @@ int Stroke::Resample(int iNPoints)
|
||||
|
||||
int Stroke::Resample(float iSampling)
|
||||
{
|
||||
//cerr << "old size :" << strokeVerticesSize() << endl;
|
||||
// cerr << "old size :" << strokeVerticesSize() << endl;
|
||||
if (iSampling == 0)
|
||||
return 0;
|
||||
if (iSampling >= _sampling)
|
||||
@@ -625,7 +626,7 @@ int Stroke::Resample(float iSampling)
|
||||
|
||||
_sampling = iSampling;
|
||||
// Resample...
|
||||
//real curvilinearLength = 0.0f;
|
||||
// real curvilinearLength = 0.0f;
|
||||
vertex_container newVertices;
|
||||
real t = 0.0f;
|
||||
const real limit = 0.99;
|
||||
@@ -641,17 +642,17 @@ int Stroke::Resample(float iSampling)
|
||||
Vec2r vec_tmp(b - a);
|
||||
real norm_var = vec_tmp.norm();
|
||||
if (norm_var <= _sampling) {
|
||||
//curvilinearLength += norm_var;
|
||||
// curvilinearLength += norm_var;
|
||||
++it;
|
||||
++next;
|
||||
continue;
|
||||
}
|
||||
|
||||
//curvilinearLength += _sampling;
|
||||
// curvilinearLength += _sampling;
|
||||
t = _sampling / norm_var;
|
||||
while (t < limit) {
|
||||
newVertex = new StrokeVertex(&(*it), &(*next), t);
|
||||
//newVertex->setCurvilinearAbscissa(curvilinearLength);
|
||||
// newVertex->setCurvilinearAbscissa(curvilinearLength);
|
||||
newVertices.push_back(newVertex);
|
||||
t = t + _sampling / norm_var;
|
||||
}
|
||||
@@ -798,7 +799,7 @@ Stroke::vertex_iterator Stroke::vertices_begin(float sampling)
|
||||
if ((sampling != 0) && (sampling < _sampling))
|
||||
Resample(sampling);
|
||||
return vertex_iterator(_Vertices.begin(), _Vertices.begin(), _Vertices.end());
|
||||
//return _Vertices.begin();
|
||||
// return _Vertices.begin();
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
@@ -143,8 +143,8 @@ class StrokeAttribute {
|
||||
}
|
||||
|
||||
/*! Returns the attribute's thickness.
|
||||
* \return an array of 2 floats. the first value is the thickness on the right of the vertex when following
|
||||
* the stroke, the second one is the thickness on the left.
|
||||
* \return an array of 2 floats. the first value is the thickness on the right of the vertex
|
||||
* when following the stroke, the second one is the thickness on the left.
|
||||
*/
|
||||
inline const float *getThickness() const
|
||||
{
|
||||
@@ -163,7 +163,8 @@ class StrokeAttribute {
|
||||
return _thickness[1];
|
||||
}
|
||||
|
||||
/*! Returns the thickness on the right and on the left of the vertex when following the stroke. */
|
||||
/*! Returns the thickness on the right and on the left of the vertex when following the stroke.
|
||||
*/
|
||||
inline Vec2f getThicknessRL() const
|
||||
{
|
||||
return Vec2f(_thickness[0], _thickness[1]);
|
||||
@@ -462,8 +463,8 @@ class StrokeVertex : public CurvePoint {
|
||||
_CurvilignAbscissa = iAbscissa;
|
||||
}
|
||||
|
||||
/*! sets the Stroke's length (it's only a value stored by the Stroke Vertex, it won't change the real
|
||||
* Stroke's length.)
|
||||
/*! sets the Stroke's length (it's only a value stored by the Stroke Vertex, it won't change the
|
||||
* real Stroke's length.)
|
||||
*/
|
||||
inline void setStrokeLength(float iLength)
|
||||
{
|
||||
@@ -498,7 +499,8 @@ class StrokeVertexIterator;
|
||||
/*! Class to define a stroke.
|
||||
* A stroke is made of a set of 2D vertices (StrokeVertex), regularly spaced out.
|
||||
* This set of vertices defines the stroke's backbone geometry.
|
||||
* Each of these stroke vertices defines the stroke's shape and appearance at this vertex position.
|
||||
* Each of these stroke vertices defines the stroke's shape and appearance at this vertex
|
||||
* position.
|
||||
*/
|
||||
class Stroke : public Interface1D {
|
||||
public: // Implementation of Interface1D
|
||||
@@ -532,7 +534,7 @@ class Stroke : public Interface1D {
|
||||
const_vertex_iterator;
|
||||
|
||||
public:
|
||||
//typedef StrokeVertex vertex_type;
|
||||
// typedef StrokeVertex vertex_type;
|
||||
|
||||
private:
|
||||
vertex_container _Vertices; //! The stroke's backbone vertices
|
||||
@@ -575,8 +577,8 @@ class Stroke : public Interface1D {
|
||||
Stroke &operator=(const Stroke &iBrother);
|
||||
|
||||
/*! Compute the sampling needed to get iNVertices vertices.
|
||||
* If the specified number of vertices is less than the actual number of vertices, the actual sampling value
|
||||
* is returned. (To remove Vertices, use the RemoveVertex() method of this class).
|
||||
* If the specified number of vertices is less than the actual number of vertices, the actual
|
||||
* sampling value is returned. (To remove Vertices, use the RemoveVertex() method of this class).
|
||||
* \param iNVertices:
|
||||
* The number of StrokeVertices we eventually want in our Stroke.
|
||||
* \return the sampling that must be used in the Resample(float) method.
|
||||
@@ -586,11 +588,10 @@ class Stroke : public Interface1D {
|
||||
float ComputeSampling(int iNVertices);
|
||||
|
||||
/*! Resampling method.
|
||||
* Resamples the curve so that it eventually has iNPoints. That means it is going to add iNPoints-vertices_size,
|
||||
* if vertices_size is the number of points we already have.
|
||||
* If vertices_size >= iNPoints, no resampling is done.
|
||||
* \param iNPoints:
|
||||
* The number of vertices we eventually want in our stroke.
|
||||
* Resamples the curve so that it eventually has iNPoints. That means it is going to add
|
||||
* iNPoints-vertices_size, if vertices_size is the number of points we already have. If
|
||||
* vertices_size >= iNPoints, no resampling is done. \param iNPoints: The number of vertices we
|
||||
* eventually want in our stroke.
|
||||
*/
|
||||
int Resample(int iNPoints);
|
||||
|
||||
@@ -838,11 +839,9 @@ class Stroke : public Interface1D {
|
||||
const_vertex_iterator vertices_end() const;
|
||||
vertex_iterator vertices_end();
|
||||
|
||||
/*! Returns a StrokeVertexIterator pointing on the first StrokeVertex of the Stroke. One can specify a sampling
|
||||
* value to resample the Stroke on the fly if needed.
|
||||
* \param t:
|
||||
* The resampling value with which we want our Stroke to be resampled.
|
||||
* If 0 is specified, no resampling is done.
|
||||
/*! Returns a StrokeVertexIterator pointing on the first StrokeVertex of the Stroke. One can
|
||||
* specify a sampling value to resample the Stroke on the fly if needed. \param t: The resampling
|
||||
* value with which we want our Stroke to be resampled. If 0 is specified, no resampling is done.
|
||||
*/
|
||||
StrokeInternal::StrokeVertexIterator strokeVerticesBegin(float t = 0.0f);
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ class vertex_iterator_base : public IteratorBase<Traits, BidirectionalIteratorTa
|
||||
typedef vertex_iterator_base<vertex_nonconst_traits> iterator;
|
||||
typedef vertex_iterator_base<vertex_const_traits> const_iterator;
|
||||
|
||||
//protected:
|
||||
// protected:
|
||||
public:
|
||||
vertex_container_iterator _it;
|
||||
vertex_container_iterator _begin;
|
||||
@@ -59,7 +59,7 @@ class vertex_iterator_base : public IteratorBase<Traits, BidirectionalIteratorTa
|
||||
|
||||
public:
|
||||
friend class Stroke;
|
||||
//friend class vertex_iterator;
|
||||
// friend class vertex_iterator;
|
||||
|
||||
inline vertex_iterator_base() : parent_class()
|
||||
{
|
||||
@@ -79,7 +79,7 @@ class vertex_iterator_base : public IteratorBase<Traits, BidirectionalIteratorTa
|
||||
_end = iBrother._end;
|
||||
}
|
||||
|
||||
//protected: //FIXME
|
||||
// protected: //FIXME
|
||||
public:
|
||||
inline vertex_iterator_base(vertex_container_iterator it,
|
||||
vertex_container_iterator begin,
|
||||
|
||||
@@ -34,15 +34,14 @@ namespace StrokeInternal {
|
||||
/////////////////////////////////////////////////
|
||||
|
||||
/*! Class defining an iterator designed to iterate over the StrokeVertex of a Stroke.
|
||||
* An instance of a StrokeVertexIterator can only be obtained from a Stroke by calling strokeVerticesBegin() or
|
||||
* strokeVerticesEnd().
|
||||
* It is iterating over the same vertices as an Interface0DIterator.
|
||||
* The difference resides in the object access. Indeed, an Interface0DIterator allows only an access to an
|
||||
* Interface0D whereas we could need to access the specialized StrokeVertex type. In this case, one
|
||||
* should use a StrokeVertexIterator.
|
||||
* The castToInterface0DIterator() method is useful to get an Interface0DIterator from a StrokeVertexIterator in
|
||||
* order to call any functions of the type UnaryFunction0D.
|
||||
* \attention In the scripting language, you must call \code it2 = StrokeVertexIterator(it1) \endcode instead of
|
||||
* An instance of a StrokeVertexIterator can only be obtained from a Stroke by calling
|
||||
* strokeVerticesBegin() or strokeVerticesEnd(). It is iterating over the same vertices as an
|
||||
* Interface0DIterator. The difference resides in the object access. Indeed, an Interface0DIterator
|
||||
* allows only an access to an Interface0D whereas we could need to access the specialized
|
||||
* StrokeVertex type. In this case, one should use a StrokeVertexIterator. The
|
||||
* castToInterface0DIterator() method is useful to get an Interface0DIterator from a
|
||||
* StrokeVertexIterator in order to call any functions of the type UnaryFunction0D. \attention In
|
||||
* the scripting language, you must call \code it2 = StrokeVertexIterator(it1) \endcode instead of
|
||||
* \code it2 = it1 \endcode where \a it1 and \a it2 are 2 StrokeVertexIterator.
|
||||
* Otherwise, incrementing \a it1 will also increment \a it2.
|
||||
*/
|
||||
@@ -84,9 +83,9 @@ class StrokeVertexIterator : public Interface0DIteratorNested {
|
||||
}
|
||||
|
||||
/*! operator=
|
||||
* \attention In the scripting language, you must call \code it2 = StrokeVertexIterator(it1) \endcode instead of
|
||||
* \code it2 = it1 \endcode where \a it1 and \a it2 are 2 StrokeVertexIterator.
|
||||
* Otherwise, incrementing \a it1 will also increment \a it2.
|
||||
* \attention In the scripting language, you must call \code it2 = StrokeVertexIterator(it1)
|
||||
* \endcode instead of \code it2 = it1 \endcode where \a it1 and \a it2 are 2
|
||||
* StrokeVertexIterator. Otherwise, incrementing \a it1 will also increment \a it2.
|
||||
*/
|
||||
StrokeVertexIterator &operator=(const StrokeVertexIterator &vi)
|
||||
{
|
||||
|
||||
@@ -116,7 +116,8 @@ class TextureManager {
|
||||
/* */
|
||||
/**********************************/
|
||||
|
||||
/*! Class to render a stroke. Creates a triangle strip and stores it strip is lazily created at the first rendering */
|
||||
/*! Class to render a stroke. Creates a triangle strip and stores it strip is lazily created at the
|
||||
* first rendering */
|
||||
class StrokeRenderer {
|
||||
public:
|
||||
StrokeRenderer();
|
||||
@@ -130,7 +131,7 @@ class StrokeRenderer {
|
||||
// lazy, checks if it has already been done
|
||||
static bool loadTextures();
|
||||
|
||||
//static unsigned int getTextureIndex(unsigned int index);
|
||||
// static unsigned int getTextureIndex(unsigned int index);
|
||||
static TextureManager *_textureManager;
|
||||
|
||||
#ifdef WITH_CXX_GUARDEDALLOC
|
||||
|
||||
@@ -113,7 +113,7 @@ static real crossP(const Vec2r &A, const Vec2r &B)
|
||||
|
||||
void Strip::createStrip(const vector<StrokeVertex *> &iStrokeVertices)
|
||||
{
|
||||
//computeParameterization();
|
||||
// computeParameterization();
|
||||
if (iStrokeVertices.size() < 2) {
|
||||
if (G.debug & G_DEBUG_FREESTYLE) {
|
||||
cout << "Warning: strip has less than 2 vertices" << endl;
|
||||
@@ -134,11 +134,11 @@ void Strip::createStrip(const vector<StrokeVertex *> &iStrokeVertices)
|
||||
StrokeVertex *sv, *sv2, *svPrev;
|
||||
int orientationErrors = 0;
|
||||
|
||||
//special case of first vertex
|
||||
// special case of first vertex
|
||||
v2 = v = iStrokeVertices.begin();
|
||||
++v2;
|
||||
sv = *v;
|
||||
vPrev = v; //in case the stroke has only 2 vertices;
|
||||
vPrev = v; // in case the stroke has only 2 vertices;
|
||||
sv2 = *v2;
|
||||
Vec2r dir(sv2->getPoint() - sv->getPoint());
|
||||
Vec2r orthDir(-dir[1], dir[0]);
|
||||
@@ -195,7 +195,7 @@ void Strip::createStrip(const vector<StrokeVertex *> &iStrokeVertices)
|
||||
svPrev = (*vPrev);
|
||||
Vec2r p(sv->getPoint()), p2(sv2->getPoint()), pPrev(svPrev->getPoint());
|
||||
|
||||
//direction and orthogonal vector to the next segment
|
||||
// direction and orthogonal vector to the next segment
|
||||
Vec2r dir(p2 - p);
|
||||
float dirNorm = dir.norm();
|
||||
dir.normalize();
|
||||
@@ -215,7 +215,7 @@ void Strip::createStrip(const vector<StrokeVertex *> &iStrokeVertices)
|
||||
}
|
||||
}
|
||||
|
||||
//direction and orthogonal vector to the previous segment
|
||||
// direction and orthogonal vector to the previous segment
|
||||
Vec2r dirPrev(p - pPrev);
|
||||
float dirPrevNorm = dirPrev.norm();
|
||||
dirPrev.normalize();
|
||||
@@ -287,7 +287,7 @@ void Strip::createStrip(const vector<StrokeVertex *> &iStrokeVertices)
|
||||
}
|
||||
} // end of for
|
||||
|
||||
//special case of last vertex
|
||||
// special case of last vertex
|
||||
sv = *v;
|
||||
sv2 = *vPrev;
|
||||
dir = Vec2r(sv->getPoint() - sv2->getPoint());
|
||||
@@ -342,7 +342,7 @@ void Strip::createStrip(const vector<StrokeVertex *> &iStrokeVertices)
|
||||
#endif
|
||||
|
||||
_averageThickness /= float(iStrokeVertices.size() - 2);
|
||||
//I did not use the first and last vertex for the average
|
||||
// I did not use the first and last vertex for the average
|
||||
if (iStrokeVertices.size() < 3)
|
||||
_averageThickness = 0.5 * (thicknessLast[1] + thicknessLast[0] + thickness[0] + thickness[1]);
|
||||
|
||||
@@ -379,7 +379,7 @@ void Strip::cleanUpSingularities(const vector<StrokeVertex *> &iStrokeVertices)
|
||||
}
|
||||
}
|
||||
|
||||
//return;
|
||||
// return;
|
||||
if (iStrokeVertices.size() < 2)
|
||||
return;
|
||||
int i = 0, j;
|
||||
@@ -389,7 +389,7 @@ void Strip::cleanUpSingularities(const vector<StrokeVertex *> &iStrokeVertices)
|
||||
bool singu1 = false, singu2 = false;
|
||||
int timeSinceSingu1 = 0, timeSinceSingu2 = 0;
|
||||
|
||||
//special case of first vertex
|
||||
// special case of first vertex
|
||||
v = iStrokeVertices.begin();
|
||||
for (vend = iStrokeVertices.end(); v != vend; v++) {
|
||||
v2 = v;
|
||||
@@ -416,7 +416,7 @@ void Strip::cleanUpSingularities(const vector<StrokeVertex *> &iStrokeVertices)
|
||||
int toto = i - timeSinceSingu1;
|
||||
if (toto < 0)
|
||||
cerr << "Stephane dit \"Toto\"" << endl;
|
||||
//traverse all the vertices of the singularity and average them
|
||||
// traverse all the vertices of the singularity and average them
|
||||
Vec2r avP(0.0, 0.0);
|
||||
for (j = i - timeSinceSingu1; j <= i; j++)
|
||||
avP = Vec2r(avP + _vertices[2 * j]->point2d());
|
||||
@@ -437,7 +437,7 @@ void Strip::cleanUpSingularities(const vector<StrokeVertex *> &iStrokeVertices)
|
||||
int toto = i - timeSinceSingu2;
|
||||
if (toto < 0)
|
||||
cerr << "Stephane dit \"Toto\"" << endl;
|
||||
//traverse all the vertices of the singularity and average them
|
||||
// traverse all the vertices of the singularity and average them
|
||||
Vec2r avP(0.0, 0.0);
|
||||
for (j = i - timeSinceSingu2; j <= i; j++)
|
||||
avP = Vec2r(avP + _vertices[2 * j + 1]->point2d());
|
||||
@@ -453,7 +453,7 @@ void Strip::cleanUpSingularities(const vector<StrokeVertex *> &iStrokeVertices)
|
||||
}
|
||||
|
||||
if (singu1) {
|
||||
//traverse all the vertices of the singularity and average them
|
||||
// traverse all the vertices of the singularity and average them
|
||||
Vec2r avP(0.0, 0.0);
|
||||
for (j = i - timeSinceSingu1; j < i; j++)
|
||||
avP = Vec2r(avP + _vertices[2 * j]->point2d());
|
||||
@@ -462,7 +462,7 @@ void Strip::cleanUpSingularities(const vector<StrokeVertex *> &iStrokeVertices)
|
||||
_vertices[2 * j]->setPoint2d(avP);
|
||||
}
|
||||
if (singu2) {
|
||||
//traverse all the vertices of the singularity and average them
|
||||
// traverse all the vertices of the singularity and average them
|
||||
Vec2r avP(0.0, 0.0);
|
||||
for (j = i - timeSinceSingu2; j < i; j++)
|
||||
avP = Vec2r(avP + _vertices[2 * j + 1]->point2d());
|
||||
@@ -760,7 +760,7 @@ StrokeRep::StrokeRep(Stroke *iStroke)
|
||||
|
||||
StrokeRep::StrokeRep(const StrokeRep &iBrother)
|
||||
{
|
||||
//soc unused - int i = 0;
|
||||
// soc unused - int i = 0;
|
||||
_stroke = iBrother._stroke;
|
||||
_strokeType = iBrother._strokeType;
|
||||
_textureId = iBrother._textureId;
|
||||
|
||||
@@ -44,20 +44,17 @@ class Stroke;
|
||||
* Any Stroke Shader must inherit from this class and overload the shade() method.
|
||||
* A StrokeShader is designed to modify any Stroke's attribute such as Thickness, Color,
|
||||
* Geometry, Texture, Blending mode...
|
||||
* The basic way to achieve this operation consists in iterating over the StrokeVertices of the Stroke
|
||||
* and to modify each one's StrokeAttribute.
|
||||
* Here is a python code example of such an iteration:
|
||||
* \code
|
||||
* it = ioStroke.strokeVerticesBegin()
|
||||
* while not it.isEnd():
|
||||
* att = it.getObject().attribute()
|
||||
* The basic way to achieve this operation consists in iterating over the StrokeVertices of the
|
||||
* Stroke and to modify each one's StrokeAttribute. Here is a python code example of such an
|
||||
* iteration: \code it = ioStroke.strokeVerticesBegin() while not it.isEnd(): att =
|
||||
* it.getObject().attribute()
|
||||
* ## perform here any attribute modification
|
||||
* it.increment()
|
||||
* \endcode
|
||||
* Here is a C++ code example of such an iteration:
|
||||
* \code
|
||||
* for (StrokeInternal::StrokeVertexIterator v = ioStroke.strokeVerticesBegin(), vend = ioStroke.strokeVerticesEnd();
|
||||
* v != vend;
|
||||
* for (StrokeInternal::StrokeVertexIterator v = ioStroke.strokeVerticesBegin(), vend =
|
||||
* ioStroke.strokeVerticesEnd(); v != vend;
|
||||
* ++v)
|
||||
* {
|
||||
* StrokeAttribute& att = v->attribute();
|
||||
|
||||
@@ -72,7 +72,7 @@ NodeGroup *StrokeTesselator::Tesselate(StrokeVertexIterator begin, StrokeVertexI
|
||||
NodeGroup *group = new NodeGroup;
|
||||
NodeShape *tshape = new NodeShape;
|
||||
group->AddChild(tshape);
|
||||
//tshape->material().setDiffuse(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
// tshape->material().setDiffuse(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
tshape->setFrsMaterial(_FrsMaterial);
|
||||
|
||||
for (StrokeVertexIterator c = begin, cend = end; c != cend; c++) {
|
||||
|
||||
@@ -23,23 +23,25 @@
|
||||
*
|
||||
* PointerSequence
|
||||
*
|
||||
* Produces a wrapped version of a sequence type (std::vector, std::deque, std::list) that will take ownership of
|
||||
* pointers that it stores. Those pointers will be deleted in its destructor.
|
||||
* Produces a wrapped version of a sequence type (std::vector, std::deque, std::list) that will
|
||||
* take ownership of pointers that it stores. Those pointers will be deleted in its destructor.
|
||||
*
|
||||
* Because the contained pointers are wholly owned by the sequence, you cannot make a copy of the sequence.
|
||||
* Making a copy would result in a double free.
|
||||
* Because the contained pointers are wholly owned by the sequence, you cannot make a copy of the
|
||||
* sequence. Making a copy would result in a double free.
|
||||
*
|
||||
* This is a no-frills class that provides no additional facilities. The user is responsible for managing any
|
||||
* pointers that are removed from the list, and for making sure that any pointers contained in the class are not
|
||||
* deleted elsewhere. Because this class does no reference counting, the user must also make sure that any pointer
|
||||
* appears only once in the sequence.
|
||||
* This is a no-frills class that provides no additional facilities. The user is responsible for
|
||||
* managing any pointers that are removed from the list, and for making sure that any pointers
|
||||
* contained in the class are not deleted elsewhere. Because this class does no reference
|
||||
* counting, the user must also make sure that any pointer appears only once in the sequence.
|
||||
*
|
||||
* If more sophisticated facilities are needed, use tr1::shared_ptr or boost::shared_ptr.
|
||||
* This class is only intended to allow one to eke by in projects where tr1 or boost are not available.
|
||||
* This class is only intended to allow one to eke by in projects where tr1 or boost are not
|
||||
* available.
|
||||
*
|
||||
* Usage: The template takes two parameters, the standard container, and the class held in the container. This is a
|
||||
* limitation of C++ templates, where T::iterator is not a type when T is a template parameter. If anyone knows a way
|
||||
* around this limitation, then the second parameter can be eliminated.
|
||||
* Usage: The template takes two parameters, the standard container, and the class held in the
|
||||
* container. This is a limitation of C++ templates, where T::iterator is not a type when T is a
|
||||
* template parameter. If anyone knows a way around this limitation, then the second parameter can
|
||||
* be eliminated.
|
||||
*
|
||||
* Example:
|
||||
* PointerSequence<vector<Widget*>, Widget*> v;
|
||||
|
||||
@@ -31,7 +31,7 @@ extern "C" {
|
||||
#include "StringUtils.h"
|
||||
#include "Interpreter.h"
|
||||
|
||||
//soc
|
||||
// soc
|
||||
extern "C" {
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
* \brief String utilities
|
||||
*/
|
||||
|
||||
//soc #include <qfileinfo.h>
|
||||
// soc #include <qfileinfo.h>
|
||||
|
||||
#include "FreestyleConfig.h"
|
||||
#include "StringUtils.h"
|
||||
|
||||
@@ -58,9 +58,9 @@ class BoxGrid {
|
||||
Polygon3r poly;
|
||||
Polygon3r cameraSpacePolygon;
|
||||
real shallowest, deepest;
|
||||
// N.B. We could, of course, store face in poly's userdata member, like the old ViewMapBuilder code does.
|
||||
// However, code comments make it clear that userdata is deprecated, so we avoid the temptation
|
||||
// to save 4 or 8 bytes.
|
||||
// N.B. We could, of course, store face in poly's userdata member, like the old ViewMapBuilder
|
||||
// code does. However, code comments make it clear that userdata is deprecated, so we avoid the
|
||||
// temptation to save 4 or 8 bytes.
|
||||
WFace *face;
|
||||
|
||||
#ifdef WITH_CXX_GUARDEDALLOC
|
||||
@@ -84,24 +84,27 @@ class BoxGrid {
|
||||
void indexPolygons();
|
||||
|
||||
real boundary[4];
|
||||
//deque<OccluderData*> faces;
|
||||
// deque<OccluderData*> faces;
|
||||
vector<OccluderData *> faces;
|
||||
};
|
||||
|
||||
public:
|
||||
/* Iterator needs to allow the user to avoid full 3D comparison in two cases:
|
||||
*
|
||||
* (1) Where (*current)->deepest < target[2], where the occluder is unambiguously in front of the target point.
|
||||
* (1) Where (*current)->deepest < target[2], where the occluder is unambiguously in front of the
|
||||
* target point.
|
||||
*
|
||||
* (2) Where (*current)->shallowest > target[2], where the occluder is unambiguously in back of the target point.
|
||||
* (2) Where (*current)->shallowest > target[2], where the occluder is unambiguously in back of
|
||||
* the target point.
|
||||
*
|
||||
* In addition, when used by OptimizedFindOccludee, Iterator should stop iterating as soon as it has an
|
||||
* occludee candidate and (*current)->shallowest > candidate[2], because at that point forward no new occluder
|
||||
* could possibly be a better occludee.
|
||||
* In addition, when used by OptimizedFindOccludee, Iterator should stop iterating as soon as it
|
||||
* has an occludee candidate and (*current)->shallowest > candidate[2], because at that point
|
||||
* forward no new occluder could possibly be a better occludee.
|
||||
*/
|
||||
class Iterator {
|
||||
public:
|
||||
// epsilon is not used in this class, but other grids with the same interface may need an epsilon
|
||||
// epsilon is not used in this class, but other grids with the same interface may need an
|
||||
// epsilon
|
||||
explicit Iterator(BoxGrid &grid, Vec3r ¢er, real epsilon = 1.0e-06);
|
||||
~Iterator();
|
||||
void initBeforeTarget();
|
||||
@@ -122,7 +125,7 @@ class BoxGrid {
|
||||
Vec3r _target;
|
||||
bool _foundOccludee;
|
||||
real _occludeeDepth;
|
||||
//deque<OccluderData*>::iterator _current, _occludeeCandidate;
|
||||
// deque<OccluderData*>::iterator _current, _occludeeCandidate;
|
||||
vector<OccluderData *>::iterator _current, _occludeeCandidate;
|
||||
|
||||
#ifdef WITH_CXX_GUARDEDALLOC
|
||||
@@ -171,7 +174,7 @@ class BoxGrid {
|
||||
void getCellCoordinates(const Vec3r &point, unsigned &x, unsigned &y);
|
||||
|
||||
typedef PointerSequence<vector<Cell *>, Cell *> cellContainer;
|
||||
//typedef PointerSequence<deque<OccluderData*>, OccluderData*> occluderContainer;
|
||||
// typedef PointerSequence<deque<OccluderData*>, OccluderData*> occluderContainer;
|
||||
typedef PointerSequence<vector<OccluderData *>, OccluderData *> occluderContainer;
|
||||
unsigned _cellsX, _cellsY;
|
||||
float _cellSize;
|
||||
@@ -222,8 +225,8 @@ inline bool BoxGrid::Iterator::testOccluder(bool wantOccludee)
|
||||
{
|
||||
// End-of-list is not even a valid iterator position
|
||||
if (_current == _cell->faces.end()) {
|
||||
// Returning true seems strange, but it will break us out of whatever loop is calling testOccluder,
|
||||
// and _current = _cell->face.end() will make the calling routine give up.
|
||||
// Returning true seems strange, but it will break us out of whatever loop is calling
|
||||
// testOccluder, and _current = _cell->face.end() will make the calling routine give up.
|
||||
return true;
|
||||
}
|
||||
#if BOX_GRID_LOGGING
|
||||
|
||||
@@ -35,8 +35,8 @@ CulledOccluderSource::CulledOccluderSource(const GridHelpers::Transform &t,
|
||||
{
|
||||
cullViewEdges(viewMap, extensiveFEdgeSearch);
|
||||
|
||||
// If we have not found any visible FEdges during our cull, then there is nothing to iterate over.
|
||||
// Short-circuit everything.
|
||||
// If we have not found any visible FEdges during our cull, then there is nothing to iterate
|
||||
// over. Short-circuit everything.
|
||||
valid = gridSpaceOccluderProsceniumInitialized;
|
||||
|
||||
if (valid && !testCurrent()) {
|
||||
@@ -107,8 +107,8 @@ void CulledOccluderSource::cullViewEdges(ViewMap &viewMap, bool extensiveFEdgeSe
|
||||
|
||||
// Non-displayable view edges will be skipped over during visibility calculation.
|
||||
|
||||
// View edges will be culled according to their position w.r.t. the viewport proscenium (viewport + 5% border,
|
||||
// or some such).
|
||||
// View edges will be culled according to their position w.r.t. the viewport proscenium (viewport
|
||||
// + 5% border, or some such).
|
||||
|
||||
// Get proscenium boundary for culling
|
||||
real viewProscenium[4];
|
||||
@@ -123,17 +123,16 @@ void CulledOccluderSource::cullViewEdges(ViewMap &viewMap, bool extensiveFEdgeSe
|
||||
cout << "Origin: [" << prosceniumOrigin[0] << ", " << prosceniumOrigin[1] << "]" << endl;
|
||||
}
|
||||
|
||||
// A separate occluder proscenium will also be maintained, starting out the same as the viewport proscenium, and
|
||||
// expanding as necessary so that it encompasses the center point of at least one feature edge in each
|
||||
// retained view edge.
|
||||
// The occluder proscenium will be used later to cull occluding triangles before they are inserted into the Grid.
|
||||
// The occluder proscenium starts out the same size as the view proscenium
|
||||
// A separate occluder proscenium will also be maintained, starting out the same as the viewport
|
||||
// proscenium, and expanding as necessary so that it encompasses the center point of at least one
|
||||
// feature edge in each retained view edge. The occluder proscenium will be used later to cull
|
||||
// occluding triangles before they are inserted into the Grid. The occluder proscenium starts out
|
||||
// the same size as the view proscenium
|
||||
GridHelpers::getDefaultViewProscenium(occluderProscenium);
|
||||
|
||||
// XXX Freestyle is inconsistent in its use of ViewMap::viewedges_container and vector<ViewEdge*>::iterator.
|
||||
// Probably all occurences of vector<ViewEdge*>::iterator should be replaced ViewMap::viewedges_container
|
||||
// throughout the code.
|
||||
// For each view edge
|
||||
// XXX Freestyle is inconsistent in its use of ViewMap::viewedges_container and
|
||||
// vector<ViewEdge*>::iterator. Probably all occurences of vector<ViewEdge*>::iterator should be
|
||||
// replaced ViewMap::viewedges_container throughout the code. For each view edge
|
||||
ViewMap::viewedges_container::iterator ve, veend;
|
||||
|
||||
for (ve = viewMap.ViewEdges().begin(), veend = viewMap.ViewEdges().end(); ve != veend; ve++) {
|
||||
@@ -154,8 +153,8 @@ void CulledOccluderSource::cullViewEdges(ViewMap &viewMap, bool extensiveFEdgeSe
|
||||
// All ViewEdges start culled
|
||||
(*ve)->setIsInImage(false);
|
||||
|
||||
// For simple visibility calculation: mark a feature edge that is known to have a center point inside
|
||||
// the occluder proscenium. Cull all other feature edges.
|
||||
// For simple visibility calculation: mark a feature edge that is known to have a center point
|
||||
// inside the occluder proscenium. Cull all other feature edges.
|
||||
do {
|
||||
// All FEdges start culled
|
||||
fe->setIsInImage(false);
|
||||
@@ -190,8 +189,8 @@ void CulledOccluderSource::cullViewEdges(ViewMap &viewMap, bool extensiveFEdgeSe
|
||||
fe = fe->nextEdge();
|
||||
} while (fe != NULL && fe != festart && !(bestOccluderTargetFound && (*ve)->isInImage()));
|
||||
|
||||
// Either we have run out of FEdges, or we already have the one edge we need to determine visibility
|
||||
// Cull all remaining edges.
|
||||
// Either we have run out of FEdges, or we already have the one edge we need to determine
|
||||
// visibility Cull all remaining edges.
|
||||
while (fe != NULL && fe != festart) {
|
||||
fe->setIsInImage(false);
|
||||
fe = fe->nextEdge();
|
||||
@@ -229,14 +228,14 @@ void CulledOccluderSource::cullViewEdges(ViewMap &viewMap, bool extensiveFEdgeSe
|
||||
|
||||
// For "Normal" or "Fast" style visibility computation only:
|
||||
|
||||
// For more detailed visibility calculation, make a second pass through the view map, marking all feature edges
|
||||
// with center points inside the final occluder proscenium. All of these feature edges can be considered during
|
||||
// visibility calculation.
|
||||
// For more detailed visibility calculation, make a second pass through the view map, marking all
|
||||
// feature edges with center points inside the final occluder proscenium. All of these feature
|
||||
// edges can be considered during visibility calculation.
|
||||
|
||||
// So far we have only found one FEdge per ViewEdge. The "Normal" and "Fast" styles of visibility computation
|
||||
// want to consider many FEdges for each ViewEdge.
|
||||
// Here we re-scan the view map to find any usable FEdges that we skipped on the first pass, or that have become
|
||||
// usable because the occluder proscenium has been expanded since the edge was visited on the first pass.
|
||||
// So far we have only found one FEdge per ViewEdge. The "Normal" and "Fast" styles of visibility
|
||||
// computation want to consider many FEdges for each ViewEdge. Here we re-scan the view map to
|
||||
// find any usable FEdges that we skipped on the first pass, or that have become usable because
|
||||
// the occluder proscenium has been expanded since the edge was visited on the first pass.
|
||||
if (extensiveFEdgeSearch) {
|
||||
// For each view edge,
|
||||
for (ve = viewMap.ViewEdges().begin(), veend = viewMap.ViewEdges().end(); ve != veend; ve++) {
|
||||
@@ -259,9 +258,9 @@ void CulledOccluderSource::cullViewEdges(ViewMap &viewMap, bool extensiveFEdgeSe
|
||||
}
|
||||
|
||||
// Up until now, all calculations have been done in camera space.
|
||||
// However, the occluder source's iteration and the grid that consumes the occluders both work in gridspace,
|
||||
// so we need a version of the occluder proscenium in gridspace.
|
||||
// Set the gridspace occlude proscenium
|
||||
// However, the occluder source's iteration and the grid that consumes the occluders both work in
|
||||
// gridspace, so we need a version of the occluder proscenium in gridspace. Set the gridspace
|
||||
// occlude proscenium
|
||||
}
|
||||
|
||||
void CulledOccluderSource::expandGridSpaceOccluderProscenium(FEdge *fe)
|
||||
|
||||
@@ -184,7 +184,7 @@ void FEdgeXDetector::computeCurvatures(WXVertex *vertex)
|
||||
// CURVATURE LAYER
|
||||
// store all the curvature datas for each vertex
|
||||
|
||||
//soc unused - real K1, K2
|
||||
// soc unused - real K1, K2
|
||||
real cos2theta, sin2theta;
|
||||
Vec3r e1, n, v;
|
||||
// one vertex curvature info :
|
||||
@@ -206,8 +206,8 @@ void FEdgeXDetector::computeCurvatures(WXVertex *vertex)
|
||||
ncycle.end();
|
||||
C->K1 = ncycle.kmin();
|
||||
C->K2 = ncycle.kmax();
|
||||
C->e1 = ncycle.Kmax(); //ncycle.kmin() * ncycle.Kmax();
|
||||
C->e2 = ncycle.Kmin(); //ncycle.kmax() * ncycle.Kmin();
|
||||
C->e1 = ncycle.Kmax(); // ncycle.kmin() * ncycle.Kmax();
|
||||
C->e2 = ncycle.Kmin(); // ncycle.kmax() * ncycle.Kmin();
|
||||
|
||||
real absK1 = fabs(C->K1);
|
||||
_meanK1 += absK1;
|
||||
@@ -320,8 +320,8 @@ void FEdgeXDetector::ProcessSilhouetteEdge(WXEdge *iEdge)
|
||||
|
||||
if ((fA->front()) ^
|
||||
(fB->front())) { // fA->visible XOR fB->visible (true if one is 0 and the other is 1)
|
||||
// The only edges we want to set as silhouette edges in this way are the ones with 2 different normals
|
||||
// for 1 vertex for these two faces
|
||||
// The only edges we want to set as silhouette edges in this way are the ones with 2 different
|
||||
// normals for 1 vertex for these two faces
|
||||
//--------------------
|
||||
// In reality we only test the normals for 1 of the 2 vertices.
|
||||
if (fA->GetVertexNormal(iEdge->GetaVertex()) == fB->GetVertexNormal(iEdge->GetaVertex()))
|
||||
@@ -392,7 +392,7 @@ void FEdgeXDetector::ProcessCreaseEdge(WXEdge *iEdge)
|
||||
void FEdgeXDetector::processRidgesAndValleysShape(WXShape *iWShape)
|
||||
{
|
||||
// Don't forget to add the built layer to the face at the end of the ProcessFace:
|
||||
//iFace->AddSmoothLayer(faceLayer);
|
||||
// iFace->AddSmoothLayer(faceLayer);
|
||||
|
||||
if (!_computeViewIndependent)
|
||||
return;
|
||||
@@ -671,7 +671,8 @@ void FEdgeXDetector::postProcessSuggestiveContourFace(WXFace *iFace)
|
||||
}
|
||||
|
||||
// At that point, we have the derivatives for each vertex of iFace.
|
||||
// All we have to do now is to use linear interpolation to compute the values at the extremities of the smooth edge.
|
||||
// All we have to do now is to use linear interpolation to compute the values at the extremities
|
||||
// of the smooth edge.
|
||||
WXSmoothEdge *sc_edge = sc_layer->getSmoothEdge();
|
||||
WOEdge *sc_oedge = sc_edge->woea();
|
||||
t = sc_edge->ta();
|
||||
|
||||
@@ -89,8 +89,9 @@ class FEdgeXDetector {
|
||||
|
||||
/*! Sets the minimum angle for detecting crease edges
|
||||
* \param angle:
|
||||
* The angular threshold in degrees (between 0 and 180) for detecting crease edges. An edge is considered
|
||||
* a crease edge if the angle between two faces sharing the edge is smaller than the given threshold.
|
||||
* The angular threshold in degrees (between 0 and 180) for detecting crease edges. An edge is
|
||||
* considered a crease edge if the angle between two faces sharing the edge is smaller than the
|
||||
* given threshold.
|
||||
*/
|
||||
// XXX angle should be in radian...
|
||||
inline void setCreaseAngle(float angle)
|
||||
@@ -211,7 +212,7 @@ class FEdgeXDetector {
|
||||
#if 0
|
||||
real _bbox_diagonal; // diagonal of the current processed shape bbox
|
||||
#endif
|
||||
//oldtmp values
|
||||
// oldtmp values
|
||||
bool _computeViewIndependent;
|
||||
real _meanK1;
|
||||
real _meanKr;
|
||||
|
||||
@@ -343,7 +343,7 @@ int GetOccludersF0D::operator()(Interface0DIterator &iter)
|
||||
set<ViewShape *> occluders;
|
||||
getOccludersF0D(iter, occluders);
|
||||
result.clear();
|
||||
//vsOccluders.insert(vsOccluders.begin(), occluders.begin(), occluders.end());
|
||||
// vsOccluders.insert(vsOccluders.begin(), occluders.begin(), occluders.end());
|
||||
for (set<ViewShape *>::iterator it = occluders.begin(), itend = occluders.end(); it != itend;
|
||||
++it) {
|
||||
result.push_back((*it));
|
||||
|
||||
@@ -55,9 +55,9 @@ using namespace Geometry;
|
||||
|
||||
/*! Base class for Unary Functions (functors) working on Interface0DIterator.
|
||||
* A unary function will be used by calling its operator() on an Interface0DIterator.
|
||||
* \attention In the scripting language, there exists several prototypes depending on the returned value type.
|
||||
* For example, you would inherit from a UnaryFunction0DDouble if you wish to define a function that returns a double.
|
||||
* The different existing prototypes are:
|
||||
* \attention In the scripting language, there exists several prototypes depending on the returned
|
||||
* value type. For example, you would inherit from a UnaryFunction0DDouble if you wish to define a
|
||||
* function that returns a double. The different existing prototypes are:
|
||||
* - UnaryFunction0DDouble
|
||||
* - UnaryFunction0DEdgeNature
|
||||
* - UnaryFunction0DFloat
|
||||
@@ -284,8 +284,9 @@ class GetParameterF0D : public UnaryFunction0D<float> {
|
||||
};
|
||||
|
||||
// VertexOrientation2DF0D
|
||||
/*! Returns a Vec2r giving the 2D oriented tangent to the 1D element to which the Interface0DIterator& belongs to and
|
||||
* evaluated at the Interface0D pointed by this Interface0DIterator&.
|
||||
/*! Returns a Vec2r giving the 2D oriented tangent to the 1D element to which the
|
||||
* Interface0DIterator& belongs to and evaluated at the Interface0D pointed by this
|
||||
* Interface0DIterator&.
|
||||
*/
|
||||
class VertexOrientation2DF0D : public UnaryFunction0D<Vec2f> {
|
||||
public:
|
||||
@@ -300,8 +301,9 @@ class VertexOrientation2DF0D : public UnaryFunction0D<Vec2f> {
|
||||
};
|
||||
|
||||
// VertexOrientation3DF0D
|
||||
/*! Returns a Vec3r giving the 3D oriented tangent to the 1D element to which the Interface0DIterator& belongs to and
|
||||
* evaluated at the Interface0D pointed by this Interface0DIterator&.
|
||||
/*! Returns a Vec3r giving the 3D oriented tangent to the 1D element to which the
|
||||
* Interface0DIterator& belongs to and evaluated at the Interface0D pointed by this
|
||||
* Interface0DIterator&.
|
||||
*/
|
||||
class VertexOrientation3DF0D : public UnaryFunction0D<Vec3f> {
|
||||
public:
|
||||
@@ -316,8 +318,9 @@ class VertexOrientation3DF0D : public UnaryFunction0D<Vec3f> {
|
||||
};
|
||||
|
||||
// Curvature2DAngleF0D
|
||||
/*! Returns a real giving the 2D curvature (as an angle) of the 1D element to which the Interface0DIterator&
|
||||
* belongs to and evaluated at the Interface0D pointed by this Interface0DIterator&.
|
||||
/*! Returns a real giving the 2D curvature (as an angle) of the 1D element to which the
|
||||
* Interface0DIterator& belongs to and evaluated at the Interface0D pointed by this
|
||||
* Interface0DIterator&.
|
||||
*/
|
||||
class Curvature2DAngleF0D : public UnaryFunction0D<double> {
|
||||
public:
|
||||
@@ -332,9 +335,10 @@ class Curvature2DAngleF0D : public UnaryFunction0D<double> {
|
||||
};
|
||||
|
||||
// ZDiscontinuity
|
||||
/*! Returns a real giving the distance between and Interface0D and the shape that lies behind (occludee).
|
||||
* This distance is evaluated in the camera space and normalized between 0 and 1. Therefore, if no object is occluded
|
||||
* by the shape to which the Interface0D belongs to, 1 is returned.
|
||||
/*! Returns a real giving the distance between and Interface0D and the shape that lies behind
|
||||
* (occludee). This distance is evaluated in the camera space and normalized between 0 and 1.
|
||||
* Therefore, if no object is occluded by the shape to which the Interface0D belongs to, 1 is
|
||||
* returned.
|
||||
*/
|
||||
class ZDiscontinuityF0D : public UnaryFunction0D<double> {
|
||||
public:
|
||||
@@ -349,8 +353,9 @@ class ZDiscontinuityF0D : public UnaryFunction0D<double> {
|
||||
};
|
||||
|
||||
// Normal2DF0D
|
||||
/*! Returns a Vec2f giving the normalized 2D normal to the 1D element to which the Interface0DIterator& belongs to and
|
||||
* evaluated at the Interface0D pointed by this Interface0DIterator&.
|
||||
/*! Returns a Vec2f giving the normalized 2D normal to the 1D element to which the
|
||||
* Interface0DIterator& belongs to and evaluated at the Interface0D pointed by this
|
||||
* Interface0DIterator&.
|
||||
*/
|
||||
class Normal2DF0D : public UnaryFunction0D<Vec2f> {
|
||||
public:
|
||||
@@ -367,11 +372,11 @@ class Normal2DF0D : public UnaryFunction0D<Vec2f> {
|
||||
// MaterialF0D
|
||||
/*! Returns the material of the object evaluated at the Interface0D.
|
||||
* This evaluation can be ambiguous (in the case of a TVertex for example.
|
||||
* This functor tries to remove this ambiguity using the context offered by the 1D element to which the
|
||||
* Interface0DIterator& belongs to and by arbitrary choosing the material of the face that lies on its left when
|
||||
* following the 1D element if there are two different materials on each side of the point.
|
||||
* However, there still can be problematic cases, and the user willing to deal with this cases in a specific way
|
||||
* should implement its own getMaterial functor.
|
||||
* This functor tries to remove this ambiguity using the context offered by the 1D element to
|
||||
* which the Interface0DIterator& belongs to and by arbitrary choosing the material of the face
|
||||
* that lies on its left when following the 1D element if there are two different materials on each
|
||||
* side of the point. However, there still can be problematic cases, and the user willing to deal
|
||||
* with this cases in a specific way should implement its own getMaterial functor.
|
||||
*/
|
||||
class MaterialF0D : public UnaryFunction0D<FrsMaterial> {
|
||||
public:
|
||||
@@ -388,10 +393,10 @@ class MaterialF0D : public UnaryFunction0D<FrsMaterial> {
|
||||
// ShapeIdF0D
|
||||
/*! Returns the Id of the Shape the Interface0D belongs to.
|
||||
* This evaluation can be ambiguous (in the case of a TVertex for example).
|
||||
* This functor tries to remove this ambiguity using the context offered by the 1D element to which the
|
||||
* Interface0DIterator& belongs to.
|
||||
* However, there still can be problematic cases, and the user willing to deal with this cases in a specific way
|
||||
* should implement its own getShapeIdF0D functor.
|
||||
* This functor tries to remove this ambiguity using the context offered by the 1D element to
|
||||
* which the Interface0DIterator& belongs to. However, there still can be problematic cases, and
|
||||
* the user willing to deal with this cases in a specific way should implement its own
|
||||
* getShapeIdF0D functor.
|
||||
*/
|
||||
class ShapeIdF0D : public UnaryFunction0D<Id> {
|
||||
public:
|
||||
@@ -408,10 +413,10 @@ class ShapeIdF0D : public UnaryFunction0D<Id> {
|
||||
// QiF0D
|
||||
/*! Returns the quantitative invisibility of this Interface0D.
|
||||
* This evaluation can be ambiguous (in the case of a TVertex for example).
|
||||
* This functor tries to remove this ambiguity using the context offered by the 1D element to which the
|
||||
* Interface0DIterator& belongs to.
|
||||
* However, there still can be problematic cases, and the user willing to deal with this cases in a specific way
|
||||
* should implement its own getQIF0D functor.
|
||||
* This functor tries to remove this ambiguity using the context offered by the 1D element to
|
||||
* which the Interface0DIterator& belongs to. However, there still can be problematic cases, and
|
||||
* the user willing to deal with this cases in a specific way should implement its own getQIF0D
|
||||
* functor.
|
||||
*/
|
||||
class QuantitativeInvisibilityF0D : public UnaryFunction0D<unsigned int> {
|
||||
public:
|
||||
|
||||
@@ -45,9 +45,9 @@ namespace Freestyle {
|
||||
|
||||
/*! Base class for Unary Functions (functors) working on Interface1D.
|
||||
* A unary function will be used by calling its operator() on an Interface1D.
|
||||
* \attention In the scripting language, there exists several prototypes depending on the returned value type.
|
||||
* For example, you would inherit from a UnaryFunction1DDouble if you wish to define a function that returns a double.
|
||||
* The different existing prototypes are:
|
||||
* \attention In the scripting language, there exists several prototypes depending on the returned
|
||||
* value type. For example, you would inherit from a UnaryFunction1DDouble if you wish to define a
|
||||
* function that returns a double. The different existing prototypes are:
|
||||
* - UnaryFunction1DDouble
|
||||
* - UnaryFunction1DEdgeNature
|
||||
* - UnaryFunction1DFloat
|
||||
@@ -73,8 +73,8 @@ template<class T> class UnaryFunction1D {
|
||||
|
||||
/*! Builds a UnaryFunction1D from an integration type.
|
||||
* \param iType:
|
||||
* In case the result for the Interface1D would be obtained by evaluating a 0D function over the different
|
||||
* Interface0D of the Interface1D, \a iType tells which integration method to use.
|
||||
* In case the result for the Interface1D would be obtained by evaluating a 0D function over
|
||||
* the different Interface0D of the Interface1D, \a iType tells which integration method to use.
|
||||
* The default integration method is the MEAN.
|
||||
*/
|
||||
UnaryFunction1D(IntegrationType iType)
|
||||
@@ -379,9 +379,10 @@ class Orientation3DF1D : public UnaryFunction1D<Vec3f> {
|
||||
};
|
||||
|
||||
// ZDiscontinuityF1D
|
||||
/*! Returns a real giving the distance between and Interface1D and the shape that lies behind (occludee).
|
||||
* This distance is evaluated in the camera space and normalized between 0 and 1. Therefore, if no object is occluded
|
||||
* by the shape to which the Interface1D belongs to, 1 is returned.
|
||||
/*! Returns a real giving the distance between and Interface1D and the shape that lies behind
|
||||
* (occludee). This distance is evaluated in the camera space and normalized between 0 and 1.
|
||||
* Therefore, if no object is occluded by the shape to which the Interface1D belongs to, 1 is
|
||||
* returned.
|
||||
*/
|
||||
class ZDiscontinuityF1D : public UnaryFunction1D<double> {
|
||||
private:
|
||||
@@ -408,9 +409,9 @@ class ZDiscontinuityF1D : public UnaryFunction1D<double> {
|
||||
|
||||
// QuantitativeInvisibilityF1D
|
||||
/*! Returns the Quantitative Invisibility of an Interface1D element.
|
||||
* If the Interface1D is a ViewEdge, then there is no ambiguity concerning the result. But, if the Interface1D
|
||||
* results of a chaining (chain, stroke), then it might be made of several 1D elements of different
|
||||
* Quantitative Invisibilities.
|
||||
* If the Interface1D is a ViewEdge, then there is no ambiguity concerning the result. But, if the
|
||||
* Interface1D results of a chaining (chain, stroke), then it might be made of several 1D elements
|
||||
* of different Quantitative Invisibilities.
|
||||
*/
|
||||
class QuantitativeInvisibilityF1D : public UnaryFunction1D<unsigned> {
|
||||
private:
|
||||
@@ -438,8 +439,9 @@ class QuantitativeInvisibilityF1D : public UnaryFunction1D<unsigned> {
|
||||
// CurveNatureF1D
|
||||
/*! Returns the nature of the Interface1D (silhouette, ridge, crease...).
|
||||
* Except if the Interface1D is a ViewEdge, this result might be ambiguous.
|
||||
* Indeed, the Interface1D might result from the gathering of several 1D elements, each one being of a different
|
||||
* nature. An integration method, such as the MEAN, might give, in this case, irrelevant results.
|
||||
* Indeed, the Interface1D might result from the gathering of several 1D elements, each one being
|
||||
* of a different nature. An integration method, such as the MEAN, might give, in this case,
|
||||
* irrelevant results.
|
||||
*/
|
||||
class CurveNatureF1D : public UnaryFunction1D<Nature::EdgeNature> {
|
||||
private:
|
||||
|
||||
@@ -110,7 +110,8 @@ class GridDensityProvider {
|
||||
Vec3r p6 = transform(Vec3r(xM, ym, zM));
|
||||
Vec3r p7 = transform(Vec3r(xM, yM, zm));
|
||||
Vec3r p8 = transform(Vec3r(xM, yM, zM));
|
||||
// Determine the proscenium face according to the min and max values of the transformed x and y coordinates
|
||||
// Determine the proscenium face according to the min and max values of the transformed x and y
|
||||
// coordinates
|
||||
proscenium[0] = std::min(std::min(std::min(p1.x(), p2.x()), std::min(p3.x(), p4.x())),
|
||||
std::min(std::min(p5.x(), p6.x()), std::min(p7.x(), p8.x())));
|
||||
proscenium[1] = std::max(std::max(std::max(p1.x(), p2.x()), std::max(p3.x(), p4.x())),
|
||||
|
||||
@@ -95,7 +95,8 @@ class Interface0D {
|
||||
/*! Returns the 2D point. */
|
||||
virtual Geometry::Vec2r getPoint2D() const;
|
||||
|
||||
/*! Returns the FEdge that lies between this Interface0D and the Interface0D given as argument. */
|
||||
/*! Returns the FEdge that lies between this Interface0D and the Interface0D given as argument.
|
||||
*/
|
||||
virtual FEdge *getFEdge(Interface0D &);
|
||||
|
||||
/*! Returns the Id of the point. */
|
||||
@@ -175,8 +176,8 @@ class Interface0DIteratorNested : public Iterator {
|
||||
|
||||
/*! Class defining an iterator over Interface0D elements.
|
||||
* An instance of this iterator is always obtained from a 1D element.
|
||||
* \attention In the scripting language, you must call \code it2 = Interface0DIterator(it1) \endcode instead of
|
||||
* \code it2 = it1 \endcode where \a it1 and \a it2 are 2 Interface0DIterator.
|
||||
* \attention In the scripting language, you must call \code it2 = Interface0DIterator(it1)
|
||||
* \endcode instead of \code it2 = it1 \endcode where \a it1 and \a it2 are 2 Interface0DIterator.
|
||||
* Otherwise, incrementing \a it1 will also increment \a it2.
|
||||
*/
|
||||
class Interface0DIterator : public Iterator {
|
||||
@@ -200,9 +201,9 @@ class Interface0DIterator : public Iterator {
|
||||
}
|
||||
|
||||
/*! Operator =
|
||||
* \attention In the scripting language, you must call \code it2 = Interface0DIterator(it1) \endcode instead of
|
||||
* \code it2 = it1 \endcode where \a it1 and \a it2 are 2 Interface0DIterator.
|
||||
* Otherwise, incrementing \a it1 will also increment \a it2.
|
||||
* \attention In the scripting language, you must call \code it2 = Interface0DIterator(it1)
|
||||
* \endcode instead of \code it2 = it1 \endcode where \a it1 and \a it2 are 2
|
||||
* Interface0DIterator. Otherwise, incrementing \a it1 will also increment \a it2.
|
||||
*/
|
||||
Interface0DIterator &operator=(const Interface0DIterator &it)
|
||||
{
|
||||
@@ -280,16 +281,16 @@ class Interface0DIterator : public Iterator {
|
||||
return _iterator->decrement();
|
||||
}
|
||||
|
||||
/*! Returns true if the pointed Interface0D is the first of the 1D element containing the points over which
|
||||
* we're iterating.
|
||||
/*! Returns true if the pointed Interface0D is the first of the 1D element containing the points
|
||||
* over which we're iterating.
|
||||
*/
|
||||
virtual bool isBegin() const
|
||||
{
|
||||
return _iterator->isBegin();
|
||||
}
|
||||
|
||||
/*! Returns true if the pointed Interface0D is after the after the last point of the 1D element we're
|
||||
* iterating from. */
|
||||
/*! Returns true if the pointed Interface0D is after the after the last point of the 1D element
|
||||
* we're iterating from. */
|
||||
virtual bool isEnd() const
|
||||
{
|
||||
return _iterator->isEnd();
|
||||
|
||||
@@ -42,24 +42,28 @@ using namespace std;
|
||||
namespace Freestyle {
|
||||
|
||||
// Integration method
|
||||
/*! The different integration methods that can be invoked to integrate into a single value the set of values obtained
|
||||
* from each 0D element of a 1D element.
|
||||
/*! The different integration methods that can be invoked to integrate into a single value the set
|
||||
* of values obtained from each 0D element of a 1D element.
|
||||
*/
|
||||
typedef enum {
|
||||
MEAN, /*!< The value computed for the 1D element is the mean of the values obtained for the 0D elements.*/
|
||||
MIN, /*!< The value computed for the 1D element is the minimum of the values obtained for the 0D elements.*/
|
||||
MAX, /*!< The value computed for the 1D element is the maximum of the values obtained for the 0D elements.*/
|
||||
FIRST, /*!< The value computed for the 1D element is the first of the values obtained for the 0D elements.*/
|
||||
LAST, /*!< The value computed for the 1D element is the last of the values obtained for the 0D elements.*/
|
||||
MEAN, /*!< The value computed for the 1D element is the mean of the values obtained for the 0D
|
||||
elements.*/
|
||||
MIN, /*!< The value computed for the 1D element is the minimum of the values obtained for the 0D
|
||||
elements.*/
|
||||
MAX, /*!< The value computed for the 1D element is the maximum of the values obtained for the 0D
|
||||
elements.*/
|
||||
FIRST, /*!< The value computed for the 1D element is the first of the values obtained for the 0D
|
||||
elements.*/
|
||||
LAST, /*!< The value computed for the 1D element is the last of the values obtained for the 0D
|
||||
elements.*/
|
||||
} IntegrationType;
|
||||
|
||||
/*! Returns a single value from a set of values evaluated at each 0D element of this 1D element.
|
||||
* \param fun:
|
||||
* The UnaryFunction0D used to compute a value at each Interface0D.
|
||||
* \param it:
|
||||
* The Interface0DIterator used to iterate over the 0D elements of this 1D element. The integration will occur
|
||||
* over the 0D elements starting from the one pointed by it.
|
||||
* \param it_end:
|
||||
* The Interface0DIterator used to iterate over the 0D elements of this 1D element. The
|
||||
* integration will occur over the 0D elements starting from the one pointed by it. \param it_end:
|
||||
* The Interface0DIterator pointing the end of the 0D elements of the 1D element.
|
||||
* \param integration_type:
|
||||
* The integration method used to compute a single value from a set of values.
|
||||
@@ -148,19 +152,17 @@ class Interface1D {
|
||||
/*! Returns an iterator over the Interface1D vertices, pointing after the last vertex. */
|
||||
virtual Interface0DIterator verticesEnd();
|
||||
|
||||
/*! Returns an iterator over the Interface1D points, pointing to the first point. The difference with
|
||||
* verticesBegin() is that here we can iterate over points of the 1D element at a any given sampling.
|
||||
* Indeed, for each iteration, a virtual point is created.
|
||||
* \param t:
|
||||
* The sampling with which we want to iterate over points of this 1D element.
|
||||
/*! Returns an iterator over the Interface1D points, pointing to the first point. The difference
|
||||
* with verticesBegin() is that here we can iterate over points of the 1D element at a any given
|
||||
* sampling. Indeed, for each iteration, a virtual point is created. \param t: The sampling with
|
||||
* which we want to iterate over points of this 1D element.
|
||||
*/
|
||||
virtual Interface0DIterator pointsBegin(float t = 0.0f);
|
||||
|
||||
/*! Returns an iterator over the Interface1D points, pointing after the last point. The difference with
|
||||
* verticesEnd() is that here we can iterate over points of the 1D element at a any given sampling.
|
||||
* Indeed, for each iteration, a virtual point is created.
|
||||
* \param t:
|
||||
* The sampling with which we want to iterate over points of this 1D element.
|
||||
/*! Returns an iterator over the Interface1D points, pointing after the last point. The
|
||||
* difference with verticesEnd() is that here we can iterate over points of the 1D element at a
|
||||
* any given sampling. Indeed, for each iteration, a virtual point is created. \param t: The
|
||||
* sampling with which we want to iterate over points of this 1D element.
|
||||
*/
|
||||
virtual Interface0DIterator pointsEnd(float t = 0.0f);
|
||||
|
||||
|
||||
@@ -286,9 +286,9 @@ real FEdge::z_discontinuity() const
|
||||
Vec3r bbox_size_vec(box.getMax() - box.getMin());
|
||||
real bboxsize = bbox_size_vec.norm();
|
||||
if (occludee_empty()) {
|
||||
//return FLT_MAX;
|
||||
// return FLT_MAX;
|
||||
return 1.0;
|
||||
//return bboxsize;
|
||||
// return bboxsize;
|
||||
}
|
||||
|
||||
#if 0
|
||||
@@ -302,7 +302,7 @@ real FEdge::z_discontinuity() const
|
||||
real res = disc_vec.norm() / bboxsize;
|
||||
|
||||
return res;
|
||||
//return fabs((middle.z() - _occludeeIntersection.z()));
|
||||
// return fabs((middle.z() - _occludeeIntersection.z()));
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
@@ -303,7 +303,8 @@ class SVertex : public Interface0D {
|
||||
_Point2D = iPoint2D;
|
||||
}
|
||||
|
||||
/*! Adds a normal to the Svertex's set of normals. If the same normal is already in the set, nothing changes. */
|
||||
/*! Adds a normal to the Svertex's set of normals. If the same normal is already in the set,
|
||||
* nothing changes. */
|
||||
inline void AddNormal(const Vec3r &iNormal)
|
||||
{
|
||||
_Normals.insert(iNormal); // if iNormal in the set already exists, nothing is done
|
||||
@@ -420,7 +421,7 @@ class SVertex : public Interface0D {
|
||||
return *(_Normals.begin());
|
||||
}
|
||||
|
||||
//Material material() const ;
|
||||
// Material material() const ;
|
||||
Id shape_id() const;
|
||||
const SShape *shape() const;
|
||||
float shape_importance() const;
|
||||
@@ -462,13 +463,12 @@ class SVertex : public Interface0D {
|
||||
class ViewEdge;
|
||||
|
||||
/*! Base Class for feature edges.
|
||||
* This FEdge can represent a silhouette, a crease, a ridge/valley, a border or a suggestive contour.
|
||||
* For silhouettes, the FEdge is oriented such as, the visible face lies on the left of the edge.
|
||||
* For borders, the FEdge is oriented such as, the face lies on the left of the edge.
|
||||
* An FEdge can represent an initial edge of the mesh or runs accross a face of the initial mesh depending
|
||||
* on the smoothness or sharpness of the mesh.
|
||||
* This class is specialized into a smooth and a sharp version since their properties slightly vary from
|
||||
* one to the other.
|
||||
* This FEdge can represent a silhouette, a crease, a ridge/valley, a border or a suggestive
|
||||
* contour. For silhouettes, the FEdge is oriented such as, the visible face lies on the left of
|
||||
* the edge. For borders, the FEdge is oriented such as, the face lies on the left of the edge. An
|
||||
* FEdge can represent an initial edge of the mesh or runs accross a face of the initial mesh
|
||||
* depending on the smoothness or sharpness of the mesh. This class is specialized into a smooth
|
||||
* and a sharp version since their properties slightly vary from one to the other.
|
||||
*/
|
||||
class FEdge : public Interface1D {
|
||||
public: // Implementation of Interface0D
|
||||
@@ -509,13 +509,13 @@ class FEdge : public Interface1D {
|
||||
SVertex *_VertexB;
|
||||
Id _Id;
|
||||
Nature::EdgeNature _Nature;
|
||||
//vector<Polygon3r> _Occluders; // visibility // NOT HANDLED BY THE COPY CONSTRUCTOR!!
|
||||
// vector<Polygon3r> _Occluders; // visibility // NOT HANDLED BY THE COPY CONSTRUCTOR!!
|
||||
|
||||
FEdge *_NextEdge; // next edge on the chain
|
||||
FEdge *_PreviousEdge;
|
||||
ViewEdge *_ViewEdge;
|
||||
// Sometimes we need to deport the visibility computation onto another edge. For example the exact edges use
|
||||
// edges of the mesh to compute their visibility
|
||||
// Sometimes we need to deport the visibility computation onto another edge. For example the
|
||||
// exact edges use edges of the mesh to compute their visibility
|
||||
|
||||
Polygon3r _aFace; // The occluded face which lies on the right of a silhouette edge
|
||||
Vec3r _occludeeIntersection;
|
||||
@@ -868,7 +868,7 @@ class FEdge : public Interface1D {
|
||||
|
||||
/* Information access interface */
|
||||
|
||||
//Material material() const;
|
||||
// Material material() const;
|
||||
Id shape_id() const;
|
||||
const SShape *shape() const;
|
||||
float shape_importance() const;
|
||||
@@ -911,7 +911,7 @@ class FEdge : public Interface1D {
|
||||
|
||||
int viewedge_nature() const;
|
||||
|
||||
//float viewedge_length() const;
|
||||
// float viewedge_length() const;
|
||||
|
||||
inline Vec3r orientation2d() const
|
||||
{
|
||||
@@ -942,16 +942,16 @@ class FEdge : public Interface1D {
|
||||
/*! Returns an iterator over the 2 (!) SVertex pointing after the last SVertex. */
|
||||
virtual inline Interface0DIterator verticesEnd();
|
||||
|
||||
/*! Returns an iterator over the FEdge points, pointing to the first point. The difference with verticesBegin()
|
||||
* is that here we can iterate over points of the FEdge at a any given sampling.
|
||||
/*! Returns an iterator over the FEdge points, pointing to the first point. The difference with
|
||||
* verticesBegin() is that here we can iterate over points of the FEdge at a any given sampling.
|
||||
* Indeed, for each iteration, a virtual point is created.
|
||||
* \param t:
|
||||
* The sampling with which we want to iterate over points of this FEdge.
|
||||
*/
|
||||
virtual inline Interface0DIterator pointsBegin(float t = 0.0f);
|
||||
|
||||
/*! Returns an iterator over the FEdge points, pointing after the last point. The difference with verticesEnd()
|
||||
* is that here we can iterate over points of the FEdge at a any given sampling.
|
||||
/*! Returns an iterator over the FEdge points, pointing after the last point. The difference with
|
||||
* verticesEnd() is that here we can iterate over points of the FEdge at a any given sampling.
|
||||
* Indeed, for each iteration, a virtual point is created.
|
||||
* \param t:
|
||||
* The sampling with which we want to iterate over points of this FEdge.
|
||||
@@ -1277,8 +1277,8 @@ class FEdgeSharp : public FEdge {
|
||||
#endif
|
||||
};
|
||||
|
||||
/*! Class defining a smooth edge. This kind of edge typically runs across a face of the input mesh. It can be
|
||||
* a silhouette, a ridge or valley, a suggestive contour.
|
||||
/*! Class defining a smooth edge. This kind of edge typically runs across a face of the input mesh.
|
||||
* It can be a silhouette, a ridge or valley, a suggestive contour.
|
||||
*/
|
||||
class FEdgeSmooth : public FEdge {
|
||||
protected:
|
||||
@@ -1402,7 +1402,8 @@ class FEdgeSmooth : public FEdge {
|
||||
/* */
|
||||
/**********************************/
|
||||
|
||||
/*! Class to define a feature shape. It is the gathering of feature elements from an identified input shape */
|
||||
/*! Class to define a feature shape. It is the gathering of feature elements from an identified
|
||||
* input shape */
|
||||
class SShape {
|
||||
private:
|
||||
vector<FEdge *> _chains; // list of fedges that are chains starting points.
|
||||
@@ -1578,10 +1579,10 @@ class SShape {
|
||||
}
|
||||
|
||||
/*! Splits an edge into several edges.
|
||||
* The edge's vertices are passed rather than the edge itself. This way, all feature edges (SILHOUETTE,
|
||||
* CREASE, BORDER) are splitted in the same time.
|
||||
* The processed edges are flagged as done (using the userdata flag).One single new vertex is created whereas
|
||||
* several splitted edges might created for the different kinds of edges. These new elements are added to the lists
|
||||
* The edge's vertices are passed rather than the edge itself. This way, all feature edges
|
||||
* (SILHOUETTE, CREASE, BORDER) are splitted in the same time. The processed edges are flagged as
|
||||
* done (using the userdata flag).One single new vertex is created whereas several splitted edges
|
||||
* might created for the different kinds of edges. These new elements are added to the lists
|
||||
* maintained by the shape.
|
||||
* New chains are also created.
|
||||
* ioA
|
||||
@@ -1589,12 +1590,11 @@ class SShape {
|
||||
* ioB
|
||||
* The second vertex for the edge that gets splitted
|
||||
* iParameters
|
||||
* A vector containing 2D real vectors indicating the parameters giving the intersections coordinates in
|
||||
* 3D and in 2D. These intersections points must be sorted from B to A.
|
||||
* Each parameter defines the intersection point I as I=A+T*AB. T<0 and T>1 are then incorrect insofar as
|
||||
* they give intersections points that lie outside the segment.
|
||||
* ioNewEdges
|
||||
* The edges that are newly created (the initial edges are not included) are added to this list.
|
||||
* A vector containing 2D real vectors indicating the parameters giving the intersections
|
||||
* coordinates in 3D and in 2D. These intersections points must be sorted from B to A. Each
|
||||
* parameter defines the intersection point I as I=A+T*AB. T<0 and T>1 are then incorrect insofar
|
||||
* as they give intersections points that lie outside the segment. ioNewEdges The edges that are
|
||||
* newly created (the initial edges are not included) are added to this list.
|
||||
*/
|
||||
inline void SplitEdge(FEdge *fe, const vector<Vec2r> &iParameters, vector<FEdge *> &ioNewEdges)
|
||||
{
|
||||
@@ -1637,7 +1637,7 @@ class SShape {
|
||||
for (vector<SVertex *>::iterator sv = intersections.begin(), svend = intersections.end();
|
||||
sv != svend;
|
||||
sv++) {
|
||||
//SVertex *svA = fe->vertexA();
|
||||
// SVertex *svA = fe->vertexA();
|
||||
SVertex *svB = fe->vertexB();
|
||||
|
||||
// We split edge AB into AA' and A'B. A' and A'B are created.
|
||||
@@ -1678,7 +1678,7 @@ class SShape {
|
||||
fe->setId(id);
|
||||
|
||||
// update edge AA' for the next pointing edge
|
||||
//ioEdge->setNextEdge(newEdge);
|
||||
// ioEdge->setNextEdge(newEdge);
|
||||
(fe)->setNextEdge(NULL);
|
||||
|
||||
// update vertex pointing edges list:
|
||||
@@ -1690,17 +1690,13 @@ class SShape {
|
||||
}
|
||||
}
|
||||
|
||||
/* splits an edge into 2 edges. The new vertex and edge are added to the sshape list of vertices and edges
|
||||
* a new chain is also created.
|
||||
* returns the new edge.
|
||||
* ioEdge
|
||||
* The edge that gets splitted
|
||||
* newpoint
|
||||
* x,y,z coordinates of the new point.
|
||||
/* splits an edge into 2 edges. The new vertex and edge are added to the sshape list of vertices
|
||||
* and edges a new chain is also created. returns the new edge. ioEdge The edge that gets
|
||||
* splitted newpoint x,y,z coordinates of the new point.
|
||||
*/
|
||||
inline FEdge *SplitEdgeIn2(FEdge *ioEdge, SVertex *ioNewVertex)
|
||||
{
|
||||
//soc unused - SVertex *A = ioEdge->vertexA();
|
||||
// soc unused - SVertex *A = ioEdge->vertexA();
|
||||
SVertex *B = ioEdge->vertexB();
|
||||
|
||||
// We split edge AB into AA' and A'B. A' and A'B are created.
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
|
||||
/** \file
|
||||
* \ingroup freestyle
|
||||
* \brief Class to perform all geometric operations dedicated to silhouette. That, for example, implies that
|
||||
* this geom engine has as member data the viewpoint, transformations, projections...
|
||||
* \brief Class to perform all geometric operations dedicated to silhouette. That, for example,
|
||||
* implies that this geom engine has as member data the viewpoint, transformations, projections...
|
||||
*/
|
||||
|
||||
#include <cstring>
|
||||
@@ -150,7 +150,8 @@ real SilhouetteGeomEngine::ImageToWorldParameter(FEdge *fe, real t)
|
||||
if (_isOrthographicProjection)
|
||||
return t;
|
||||
|
||||
// we need to compute for each parameter t the corresponding parameter T which gives the intersection in 3D.
|
||||
// we need to compute for each parameter t the corresponding parameter T which gives the
|
||||
// intersection in 3D.
|
||||
real T;
|
||||
|
||||
// suffix w for world, c for camera, r for retina, i for image
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
/** \file
|
||||
* \ingroup freestyle
|
||||
* \brief Class to perform all geometric operations dedicated to silhouette. That, for example, implies that
|
||||
* this geom engine has as member data the viewpoint, transformations, projections...
|
||||
* \brief Class to perform all geometric operations dedicated to silhouette. That, for example,
|
||||
* implies that this geom engine has as member data the viewpoint, transformations, projections...
|
||||
*/
|
||||
|
||||
#include <vector>
|
||||
|
||||
@@ -187,9 +187,9 @@ void SphericalGrid::distributePolygons(OccluderSource &source)
|
||||
}
|
||||
}
|
||||
catch (...) {
|
||||
// If an exception was thrown, _faces.push_back() cannot have succeeded. Occluder is not owned by anyone,
|
||||
// and must be deleted. If the exception was thrown before or during new OccluderData(), then
|
||||
// occluder is NULL, and this delete is harmless.
|
||||
// If an exception was thrown, _faces.push_back() cannot have succeeded. Occluder is not
|
||||
// owned by anyone, and must be deleted. If the exception was thrown before or during new
|
||||
// OccluderData(), then occluder is NULL, and this delete is harmless.
|
||||
delete occluder;
|
||||
throw;
|
||||
}
|
||||
|
||||
@@ -24,8 +24,9 @@
|
||||
|
||||
#define SPHERICAL_GRID_LOGGING 0
|
||||
|
||||
// I would like to avoid using deque because including ViewMap.h and <deque> or <vector> separately results in
|
||||
// redefinitions of identifiers. ViewMap.h already includes <vector> so it should be a safe fall-back.
|
||||
// I would like to avoid using deque because including ViewMap.h and <deque> or <vector> separately
|
||||
// results in redefinitions of identifiers. ViewMap.h already includes <vector> so it should be a
|
||||
// safe fall-back.
|
||||
//#include <vector>
|
||||
//#include <deque>
|
||||
|
||||
@@ -57,9 +58,9 @@ class SphericalGrid {
|
||||
Polygon3r poly;
|
||||
Polygon3r cameraSpacePolygon;
|
||||
real shallowest, deepest;
|
||||
// N.B. We could, of course, store face in poly's userdata member, like the old ViewMapBuilder code does.
|
||||
// However, code comments make it clear that userdata is deprecated, so we avoid the temptation to save
|
||||
// 4 or 8 bytes.
|
||||
// N.B. We could, of course, store face in poly's userdata member, like the old ViewMapBuilder
|
||||
// code does. However, code comments make it clear that userdata is deprecated, so we avoid the
|
||||
// temptation to save 4 or 8 bytes.
|
||||
WFace *face;
|
||||
|
||||
#ifdef WITH_CXX_GUARDEDALLOC
|
||||
@@ -70,8 +71,8 @@ class SphericalGrid {
|
||||
private:
|
||||
struct Cell {
|
||||
// Can't store Cell in a vector without copy and assign
|
||||
//Cell(const Cell& other);
|
||||
//Cell& operator=(const Cell& other);
|
||||
// Cell(const Cell& other);
|
||||
// Cell& operator=(const Cell& other);
|
||||
|
||||
explicit Cell();
|
||||
~Cell();
|
||||
@@ -83,25 +84,28 @@ class SphericalGrid {
|
||||
void indexPolygons();
|
||||
|
||||
real boundary[4];
|
||||
//deque<OccluderData*> faces;
|
||||
// deque<OccluderData*> faces;
|
||||
vector<OccluderData *> faces;
|
||||
};
|
||||
|
||||
public:
|
||||
/*! Iterator needs to allow the user to avoid full 3D comparison in two cases:
|
||||
*
|
||||
* (1) Where (*current)->deepest < target[2], where the occluder is unambiguously in front of the target point.
|
||||
* (1) Where (*current)->deepest < target[2], where the occluder is unambiguously in front of
|
||||
* the target point.
|
||||
*
|
||||
* (2) Where (*current)->shallowest > target[2], where the occluder is unambiguously in back of the target point.
|
||||
* (2) Where (*current)->shallowest > target[2], where the occluder is unambiguously in back of
|
||||
* the target point.
|
||||
*
|
||||
* In addition, when used by OptimizedFindOccludee, Iterator should stop iterating as soon as it has an occludee
|
||||
* candidate and (*current)->shallowest > candidate[2], because at that point forward no new occluder could
|
||||
* possibly be a better occludee.
|
||||
* In addition, when used by OptimizedFindOccludee, Iterator should stop iterating as soon as it
|
||||
* has an occludee candidate and (*current)->shallowest > candidate[2], because at that point
|
||||
* forward no new occluder could possibly be a better occludee.
|
||||
*/
|
||||
|
||||
class Iterator {
|
||||
public:
|
||||
// epsilon is not used in this class, but other grids with the same interface may need an epsilon
|
||||
// epsilon is not used in this class, but other grids with the same interface may need an
|
||||
// epsilon
|
||||
explicit Iterator(SphericalGrid &grid, Vec3r ¢er, real epsilon = 1.0e-06);
|
||||
~Iterator();
|
||||
void initBeforeTarget();
|
||||
@@ -122,7 +126,7 @@ class SphericalGrid {
|
||||
Vec3r _target;
|
||||
bool _foundOccludee;
|
||||
real _occludeeDepth;
|
||||
//deque<OccluderData*>::iterator _current, _occludeeCandidate;
|
||||
// deque<OccluderData*>::iterator _current, _occludeeCandidate;
|
||||
vector<OccluderData *>::iterator _current, _occludeeCandidate;
|
||||
|
||||
#ifdef WITH_CXX_GUARDEDALLOC
|
||||
@@ -171,7 +175,7 @@ class SphericalGrid {
|
||||
void getCellCoordinates(const Vec3r &point, unsigned &x, unsigned &y);
|
||||
|
||||
typedef PointerSequence<vector<Cell *>, Cell *> cellContainer;
|
||||
//typedef PointerSequence<deque<OccluderData*>, OccluderData*> occluderContainer;
|
||||
// typedef PointerSequence<deque<OccluderData*>, OccluderData*> occluderContainer;
|
||||
typedef PointerSequence<vector<OccluderData *>, OccluderData *> occluderContainer;
|
||||
unsigned _cellsX, _cellsY;
|
||||
float _cellSize;
|
||||
@@ -222,8 +226,8 @@ inline bool SphericalGrid::Iterator::testOccluder(bool wantOccludee)
|
||||
{
|
||||
// End-of-list is not even a valid iterator position
|
||||
if (_current == _cell->faces.end()) {
|
||||
// Returning true seems strange, but it will break us out of whatever loop is calling testOccluder, and
|
||||
// _current=_cell->face.end() will make the calling routine give up.
|
||||
// Returning true seems strange, but it will break us out of whatever loop is calling
|
||||
// testOccluder, and _current=_cell->face.end() will make the calling routine give up.
|
||||
return true;
|
||||
}
|
||||
#if SPHERICAL_GRID_LOGGING
|
||||
@@ -286,15 +290,17 @@ inline bool SphericalGrid::Iterator::testOccluder(bool wantOccludee)
|
||||
return false;
|
||||
}
|
||||
|
||||
// We've done all the corner cutting we can. Let the caller work out whether or not the geometry is correct.
|
||||
// We've done all the corner cutting we can. Let the caller work out whether or not the geometry
|
||||
// is correct.
|
||||
return true;
|
||||
}
|
||||
|
||||
inline void SphericalGrid::Iterator::reportDepth(Vec3r origin, Vec3r u, real t)
|
||||
{
|
||||
// The reported depth is the length of a ray in camera space. We need to convert it into the distance from viewpoint
|
||||
// If origin is the viewpoint, depth == t. A future optimization could allow the caller to tell us if origin is
|
||||
// viewponit or target, at the cost of changing the OptimizedGrid API.
|
||||
// The reported depth is the length of a ray in camera space. We need to convert it into the
|
||||
// distance from viewpoint If origin is the viewpoint, depth == t. A future optimization could
|
||||
// allow the caller to tell us if origin is viewponit or target, at the cost of changing the
|
||||
// OptimizedGrid API.
|
||||
real depth = (origin + u * t).norm();
|
||||
#if SPHERICAL_GRID_LOGGING
|
||||
if (G.debug & G_DEBUG_FREESTYLE) {
|
||||
|
||||
@@ -16,7 +16,8 @@
|
||||
|
||||
/** \file
|
||||
* \ingroup freestyle
|
||||
* \brief Convenient access to the steerable ViewMap to which any element of the ViewMap belongs to.
|
||||
* \brief Convenient access to the steerable ViewMap to which any element of the ViewMap belongs
|
||||
* to.
|
||||
*/
|
||||
|
||||
#include <sstream>
|
||||
@@ -146,7 +147,7 @@ double *SteerableViewMap::AddFEdge(FEdge *iFEdge)
|
||||
unsigned SteerableViewMap::getSVMNumber(const Vec2f &orient)
|
||||
{
|
||||
Vec2f dir(orient);
|
||||
//soc unsigned res = 0;
|
||||
// soc unsigned res = 0;
|
||||
real norm = dir.norm();
|
||||
if (norm < 1.0e-6) {
|
||||
return _nbOrientations + 1;
|
||||
@@ -211,11 +212,11 @@ float SteerableViewMap::readSteerableViewMapPixel(unsigned iOrientation, int iLe
|
||||
}
|
||||
if ((x < 0) || (x >= pyramid->width()) || (y < 0) || (y >= pyramid->height()))
|
||||
return 0;
|
||||
//float v = pyramid->pixel(x, pyramid->height() - 1 - y, iLevel) * 255.0f;
|
||||
// We encode both the directionality and the lines counting on 8 bits (because of frame buffer). Thus, we allow
|
||||
// until 8 lines to pass through the same pixel, so that we can discretize the Pi/_nbOrientations angle into
|
||||
// 32 slices. Therefore, for example, in the vertical direction, a vertical line will have the value 32 on
|
||||
// each pixel it passes through.
|
||||
// float v = pyramid->pixel(x, pyramid->height() - 1 - y, iLevel) * 255.0f;
|
||||
// We encode both the directionality and the lines counting on 8 bits (because of frame buffer).
|
||||
// Thus, we allow until 8 lines to pass through the same pixel, so that we can discretize the
|
||||
// Pi/_nbOrientations angle into 32 slices. Therefore, for example, in the vertical direction, a
|
||||
// vertical line will have the value 32 on each pixel it passes through.
|
||||
float v = pyramid->pixel(x, pyramid->height() - 1 - y, iLevel) / 32.0f;
|
||||
return v;
|
||||
}
|
||||
@@ -243,31 +244,31 @@ void SteerableViewMap::saveSteerableViewMap() const
|
||||
int ow = _imagesPyramids[i]->width(0);
|
||||
int oh = _imagesPyramids[i]->height(0);
|
||||
|
||||
//soc QString base("SteerableViewMap");
|
||||
// soc QString base("SteerableViewMap");
|
||||
string base("SteerableViewMap");
|
||||
stringstream filename;
|
||||
|
||||
for (int j = 0; j < _imagesPyramids[i]->getNumberOfLevels(); ++j) { //soc
|
||||
for (int j = 0; j < _imagesPyramids[i]->getNumberOfLevels(); ++j) { // soc
|
||||
float coeff = 1.0f; // 1 / 255.0f; // 100 * 255; // * pow(2, j);
|
||||
//soc QImage qtmp(ow, oh, QImage::Format_RGB32);
|
||||
// soc QImage qtmp(ow, oh, QImage::Format_RGB32);
|
||||
ImBuf *ibuf = IMB_allocImBuf(ow, oh, 32, IB_rect);
|
||||
int rowbytes = ow * 4;
|
||||
char *pix;
|
||||
|
||||
for (int y = 0; y < oh; ++y) { //soc
|
||||
for (int x = 0; x < ow; ++x) { //soc
|
||||
for (int y = 0; y < oh; ++y) { // soc
|
||||
for (int x = 0; x < ow; ++x) { // soc
|
||||
int c = (int)(coeff * _imagesPyramids[i]->pixel(x, y, j));
|
||||
if (c > 255)
|
||||
c = 255;
|
||||
//int c = (int)(_imagesPyramids[i]->pixel(x, y, j));
|
||||
// int c = (int)(_imagesPyramids[i]->pixel(x, y, j));
|
||||
|
||||
//soc qtmp.setPixel(x, y, qRgb(c, c, c));
|
||||
// soc qtmp.setPixel(x, y, qRgb(c, c, c));
|
||||
pix = (char *)ibuf->rect + y * rowbytes + x * 4;
|
||||
pix[0] = pix[1] = pix[2] = c;
|
||||
}
|
||||
}
|
||||
|
||||
//soc qtmp.save(base+QString::number(i)+"-"+QString::number(j)+".png", "PNG");
|
||||
// soc qtmp.save(base+QString::number(i)+"-"+QString::number(j)+".png", "PNG");
|
||||
filename << base;
|
||||
filename << i << "-" << j << ".png";
|
||||
ibuf->ftype = IMB_FTYPE_PNG;
|
||||
|
||||
@@ -19,7 +19,8 @@
|
||||
|
||||
/** \file
|
||||
* \ingroup freestyle
|
||||
* \brief Convenient access to the steerable ViewMap to which any element of the ViewMap belongs to.
|
||||
* \brief Convenient access to the steerable ViewMap to which any element of the ViewMap belongs
|
||||
* to.
|
||||
*/
|
||||
|
||||
#include <map>
|
||||
@@ -42,8 +43,8 @@ class FEdge;
|
||||
class ImagePyramid;
|
||||
class GrayImage;
|
||||
|
||||
/*! This class checks for every FEdge in which steerable it belongs and stores the mapping allowing to retrieve
|
||||
* this information from the FEdge Id.
|
||||
/*! This class checks for every FEdge in which steerable it belongs and stores the mapping allowing
|
||||
* to retrieve this information from the FEdge Id.
|
||||
*/
|
||||
class SteerableViewMap {
|
||||
protected:
|
||||
@@ -66,8 +67,8 @@ class SteerableViewMap {
|
||||
virtual void Reset();
|
||||
|
||||
/*! Adds a FEdge to steerable VM.
|
||||
* Returns the nbOrientations weights corresponding to the FEdge contributions to the nbOrientations
|
||||
* directional maps.
|
||||
* Returns the nbOrientations weights corresponding to the FEdge contributions to the
|
||||
* nbOrientations directional maps.
|
||||
*/
|
||||
double *AddFEdge(FEdge *iFEdge);
|
||||
|
||||
@@ -86,17 +87,13 @@ class SteerableViewMap {
|
||||
*/
|
||||
unsigned getSVMNumber(unsigned id);
|
||||
|
||||
/*! Builds _nbOrientations+1 pyramids of images from the _nbOrientations+1 base images of the steerable viewmap.
|
||||
* \param steerableBases:
|
||||
* The _nbOrientations+1 images constituting the basis for the steerable pyramid.
|
||||
* \param copy:
|
||||
* If false, the data is not duplicated, and Canvas deals with the memory management of these
|
||||
* _nbOrientations+1 images. If true, data is copied, and it's up to the caller to delete the images.
|
||||
* \param iNbLevels:
|
||||
* The number of levels desired for each pyramid.
|
||||
* If iNbLevels == 0, the complete pyramid is built.
|
||||
* \param iSigma:
|
||||
* The sigma that will be used for the gaussian blur
|
||||
/*! Builds _nbOrientations+1 pyramids of images from the _nbOrientations+1 base images of the
|
||||
* steerable viewmap. \param steerableBases: The _nbOrientations+1 images constituting the basis
|
||||
* for the steerable pyramid. \param copy: If false, the data is not duplicated, and Canvas deals
|
||||
* with the memory management of these _nbOrientations+1 images. If true, data is copied, and
|
||||
* it's up to the caller to delete the images. \param iNbLevels: The number of levels desired for
|
||||
* each pyramid. If iNbLevels == 0, the complete pyramid is built. \param iSigma: The sigma that
|
||||
* will be used for the gaussian blur
|
||||
*/
|
||||
void buildImagesPyramids(GrayImage **steerableBases,
|
||||
bool copy = false,
|
||||
@@ -116,15 +113,15 @@ class SteerableViewMap {
|
||||
* \param iLevel:
|
||||
* The level of the pyramid we want to read
|
||||
* \param x:
|
||||
* The abscissa of the desired pixel specified in level0 coordinate system. The origin is the lower left corner.
|
||||
* \param y:
|
||||
* The ordinate of the desired pixel specified in level0 coordinate system. The origin is the lower left corner.
|
||||
* The abscissa of the desired pixel specified in level0 coordinate system. The origin is the
|
||||
* lower left corner. \param y: The ordinate of the desired pixel specified in level0 coordinate
|
||||
* system. The origin is the lower left corner.
|
||||
*/
|
||||
float readSteerableViewMapPixel(unsigned iOrientation, int iLevel, int x, int y);
|
||||
|
||||
/*! Reads a pixel in the one of the level of the pyramid containing the images of the complete ViewMap.
|
||||
* Returns a value between 0 and 1.
|
||||
* Equivalent to : readSteerableViewMapPixel(nbOrientations, x, y)
|
||||
/*! Reads a pixel in the one of the level of the pyramid containing the images of the complete
|
||||
* ViewMap. Returns a value between 0 and 1. Equivalent to :
|
||||
* readSteerableViewMapPixel(nbOrientations, x, y)
|
||||
*/
|
||||
float readCompleteViewMapPixel(int iLevel, int x, int y);
|
||||
|
||||
|
||||
@@ -79,8 +79,8 @@ void ViewEdgeXBuilder::BuildViewEdges(WXShape *iWShape,
|
||||
continue;
|
||||
if (stopSmoothViewEdge((*sl))) // has it been parsed already ?
|
||||
continue;
|
||||
// here we know that we're dealing with a face layer that has not been processed yet and that contains
|
||||
// a smooth edge.
|
||||
// here we know that we're dealing with a face layer that has not been processed yet and that
|
||||
// contains a smooth edge.
|
||||
/* vedge =*//* UNUSED */ BuildSmoothViewEdge(OWXFaceLayer(*sl, true));
|
||||
}
|
||||
}
|
||||
@@ -89,7 +89,7 @@ void ViewEdgeXBuilder::BuildViewEdges(WXShape *iWShape,
|
||||
//----------------------------------
|
||||
// Reset all userdata for WXEdge structure
|
||||
//----------------------------------------
|
||||
//iWShape->ResetUserData();
|
||||
// iWShape->ResetUserData();
|
||||
|
||||
WXEdge *wxe;
|
||||
vector<WEdge *> &wedges = iWShape->getEdgeList();
|
||||
@@ -339,7 +339,8 @@ OWXFaceLayer ViewEdgeXBuilder::FindNextFaceLayer(const OWXFaceLayer &iFaceLayer)
|
||||
nextFace = dynamic_cast<WXFace *>(iFaceLayer.fl->getFace()->GetBordingFace(woeend));
|
||||
if (!nextFace)
|
||||
return OWXFaceLayer(NULL, true);
|
||||
// if the next face layer has either no smooth edge or no smooth edge of same nature, no next face
|
||||
// if the next face layer has either no smooth edge or no smooth edge of same nature, no next
|
||||
// face
|
||||
if (!nextFace->hasSmoothEdges())
|
||||
return OWXFaceLayer(NULL, true);
|
||||
vector<WXFaceLayer *> sameNatureLayers;
|
||||
@@ -411,7 +412,8 @@ OWXFaceLayer ViewEdgeXBuilder::FindPreviousFaceLayer(const OWXFaceLayer &iFaceLa
|
||||
previousFace = dynamic_cast<WXFace *>(iFaceLayer.fl->getFace()->GetBordingFace(woebegin));
|
||||
if (0 == previousFace)
|
||||
return OWXFaceLayer(NULL, true);
|
||||
// if the next face layer has either no smooth edge or no smooth edge of same nature, no next face
|
||||
// if the next face layer has either no smooth edge or no smooth edge of same nature, no next
|
||||
// face
|
||||
if (!previousFace->hasSmoothEdges())
|
||||
return OWXFaceLayer(NULL, true);
|
||||
vector<WXFaceLayer *> sameNatureLayers;
|
||||
@@ -688,7 +690,7 @@ FEdge *ViewEdgeXBuilder::BuildSharpFEdge(FEdge *feprevious, const OWXEdge &iwe)
|
||||
_pCurrentSShape->AddEdge(fe);
|
||||
va->AddFEdge(fe);
|
||||
vb->AddFEdge(fe);
|
||||
//Add normals:
|
||||
// Add normals:
|
||||
va->AddNormal(normalA);
|
||||
va->AddNormal(normalB);
|
||||
vb->AddNormal(normalA);
|
||||
|
||||
@@ -28,7 +28,8 @@
|
||||
|
||||
#if 0 // soc
|
||||
# if defined(__GNUC__) && (__GNUC__ >= 3)
|
||||
//hash_map is not part of the C++ standard anymore; hash_map.h has been kept though for backward compatibility
|
||||
/* hash_map is not part of the C++ standard anymore;
|
||||
* hash_map.h has been kept though for backward compatibility */
|
||||
# include <hash_map.h>
|
||||
# else
|
||||
# include <hash_map>
|
||||
@@ -278,9 +279,9 @@ class ViewEdgeXBuilder {
|
||||
/*! instanciate a ViewVertex from a SVertex, if it doesn't exist yet */
|
||||
ViewVertex *MakeViewVertex(SVertex *iSVertex);
|
||||
|
||||
//oldtmp values
|
||||
//IdHashTable _hashtable;
|
||||
//VVIdHashTable _multivertexHashTable;
|
||||
// oldtmp values
|
||||
// IdHashTable _hashtable;
|
||||
// VVIdHashTable _multivertexHashTable;
|
||||
SVertexMap _SVertexMap;
|
||||
SShape *_pCurrentSShape;
|
||||
ViewShape *_pCurrentVShape;
|
||||
|
||||
@@ -155,8 +155,8 @@ TVertex *ViewMap::CreateTVertex(const Vec3r &iA3D,
|
||||
SVertex *Ia = shapeA->CreateSVertex(iA3D, iA2D, iFEdgeA->vertexA()->getId());
|
||||
SVertex *Ib = shapeB->CreateSVertex(iB3D, iB2D, iFEdgeB->vertexA()->getId());
|
||||
|
||||
// depending on which of these 2 svertices is the nearest from the viewpoint, we're going to build the TVertex
|
||||
// by giving them in an order or another (the first one must be the nearest)
|
||||
// depending on which of these 2 svertices is the nearest from the viewpoint, we're going to
|
||||
// build the TVertex by giving them in an order or another (the first one must be the nearest)
|
||||
real dista = Ia->point2D()[2];
|
||||
real distb = Ib->point2D()[2];
|
||||
|
||||
@@ -185,8 +185,8 @@ ViewVertex *ViewMap::InsertViewVertex(SVertex *iVertex, vector<ViewEdge *> &newV
|
||||
NonTVertex *vva = dynamic_cast<NonTVertex *>(iVertex->viewvertex());
|
||||
if (vva)
|
||||
return vva;
|
||||
// because it is not already a ViewVertex, this SVertex must have only 2 FEdges. The incoming one still belongs
|
||||
// to ioEdge, the outgoing one now belongs to newVEdge
|
||||
// because it is not already a ViewVertex, this SVertex must have only 2 FEdges. The incoming one
|
||||
// still belongs to ioEdge, the outgoing one now belongs to newVEdge
|
||||
const vector<FEdge *> &fedges = iVertex->fedges();
|
||||
if (fedges.size() != 2) {
|
||||
cerr << "ViewMap warning: Can't split the ViewEdge" << endl;
|
||||
@@ -235,7 +235,7 @@ ViewVertex *ViewMap::InsertViewVertex(SVertex *iVertex, vector<ViewEdge *> &newV
|
||||
ViewEdge *newVEdge = new ViewEdge(vva, ioEdge->B(), fbegin, ioEdge->fedgeB(), vshape);
|
||||
newVEdge->setId(Id(ioEdge->getId().getFirst(), ioEdge->getId().getSecond() + 1));
|
||||
newVEdge->setNature(ioEdge->getNature());
|
||||
//newVEdge->UpdateFEdges(); // done in the ViewEdge constructor
|
||||
// newVEdge->UpdateFEdges(); // done in the ViewEdge constructor
|
||||
// Update old ViewEdge
|
||||
ioEdge->setB(vva);
|
||||
ioEdge->setFEdgeB(fend);
|
||||
@@ -253,7 +253,7 @@ ViewVertex *ViewMap::InsertViewVertex(SVertex *iVertex, vector<ViewEdge *> &newV
|
||||
vvb->Replace(ioEdge, newVEdge);
|
||||
|
||||
// update ViewShape
|
||||
//vshape->AddEdge(newVEdge);
|
||||
// vshape->AddEdge(newVEdge);
|
||||
// update SShape
|
||||
vshape->sshape()->AddChain(fbegin);
|
||||
// update ViewMap
|
||||
@@ -421,25 +421,27 @@ void TVertex::Replace(ViewEdge *iOld, ViewEdge *iNew)
|
||||
/*! iterators access */
|
||||
ViewVertex::edge_iterator TVertex::edges_begin()
|
||||
{
|
||||
//return edge_iterator(_FrontEdgeA, _FrontEdgeB, _BackEdgeA, _BackEdgeB, _FrontEdgeA);
|
||||
// return edge_iterator(_FrontEdgeA, _FrontEdgeB, _BackEdgeA, _BackEdgeB, _FrontEdgeA);
|
||||
return edge_iterator(_sortedEdges.begin(), _sortedEdges.end(), _sortedEdges.begin());
|
||||
}
|
||||
|
||||
ViewVertex::const_edge_iterator TVertex::edges_begin() const
|
||||
{
|
||||
//return const_edge_iterator(_FrontEdgeA, _FrontEdgeB, _BackEdgeA, _BackEdgeB, _FrontEdgeA);
|
||||
// return const_edge_iterator(_FrontEdgeA, _FrontEdgeB, _BackEdgeA, _BackEdgeB, _FrontEdgeA);
|
||||
return const_edge_iterator(_sortedEdges.begin(), _sortedEdges.end(), _sortedEdges.begin());
|
||||
}
|
||||
|
||||
ViewVertex::edge_iterator TVertex::edges_end()
|
||||
{
|
||||
//return edge_iterator(_FrontEdgeA, _FrontEdgeB, _BackEdgeA, _BackEdgeB, directedViewEdge(0,true));
|
||||
// return edge_iterator(_FrontEdgeA, _FrontEdgeB, _BackEdgeA, _BackEdgeB,
|
||||
// directedViewEdge(0,true));
|
||||
return edge_iterator(_sortedEdges.begin(), _sortedEdges.end(), _sortedEdges.end());
|
||||
}
|
||||
|
||||
ViewVertex::const_edge_iterator TVertex::edges_end() const
|
||||
{
|
||||
//return const_edge_iterator(_FrontEdgeA, _FrontEdgeB, _BackEdgeA, _BackEdgeB, directedViewEdge(0, true));
|
||||
// return const_edge_iterator(_FrontEdgeA, _FrontEdgeB, _BackEdgeA, _BackEdgeB,
|
||||
// directedViewEdge(0, true));
|
||||
return const_edge_iterator(_sortedEdges.begin(), _sortedEdges.end(), _sortedEdges.end());
|
||||
}
|
||||
|
||||
|
||||
@@ -75,8 +75,8 @@ class ViewMap {
|
||||
fedges_container _FEdges; // feature edges (embedded edges)
|
||||
svertices_container _SVertices; // embedded vertices
|
||||
BBox<Vec3r> _scene3DBBox;
|
||||
// Mapping between the WShape or VShape id to the VShape index in the _VShapes vector. Used in the method
|
||||
// viewShape(int id) to access a shape from its id.
|
||||
// Mapping between the WShape or VShape id to the VShape index in the _VShapes vector. Used in
|
||||
// the method viewShape(int id) to access a shape from its id.
|
||||
id_to_index_map _shapeIdToIndex;
|
||||
|
||||
public:
|
||||
@@ -222,16 +222,15 @@ class ViewMap {
|
||||
FEdge *iFEdgeB,
|
||||
const Id &id);
|
||||
|
||||
/* Updates the structures to take into account the fact that a SVertex must now be considered as a ViewVertex
|
||||
* iVertex
|
||||
* The SVertex on top of which the ViewVertex is built (it is necessarily a NonTVertex because it is a SVertex)
|
||||
* newViewEdges
|
||||
* The new ViewEdges that must be add to the ViewMap
|
||||
/* Updates the structures to take into account the fact that a SVertex must now be considered as
|
||||
* a ViewVertex iVertex The SVertex on top of which the ViewVertex is built (it is necessarily a
|
||||
* NonTVertex because it is a SVertex) newViewEdges The new ViewEdges that must be add to the
|
||||
* ViewMap
|
||||
*/
|
||||
ViewVertex *InsertViewVertex(SVertex *iVertex, vector<ViewEdge *> &newViewEdges);
|
||||
|
||||
/* connects a FEdge to the graph trough a SVertex */
|
||||
//FEdge *Connect(FEdge *ioEdge, SVertex *ioVertex);
|
||||
// FEdge *Connect(FEdge *ioEdge, SVertex *ioVertex);
|
||||
|
||||
/* Clean temporary FEdges created by chaining */
|
||||
virtual void Clean();
|
||||
@@ -262,11 +261,12 @@ class orientedViewEdgeIterator;
|
||||
} // namespace ViewVertexInternal
|
||||
|
||||
/*! Class to define a view vertex.
|
||||
* A view vertex is a feature vertex corresponding to a point of the image graph, where the characteristics of an
|
||||
* edge might change (nature, visibility, ...).
|
||||
* A ViewVertex can be of two kinds: a TVertex when it corresponds to the intersection between two ViewEdges or a
|
||||
* NonTVertex when it corresponds to a vertex of the initial input mesh (it is the case for vertices such as corners
|
||||
* for example). Thus, this class can be specialized into two classes, the TVertex class and the NonTVertex class.
|
||||
* A view vertex is a feature vertex corresponding to a point of the image graph, where the
|
||||
* characteristics of an edge might change (nature, visibility, ...). A ViewVertex can be of two
|
||||
* kinds: a TVertex when it corresponds to the intersection between two ViewEdges or a NonTVertex
|
||||
* when it corresponds to a vertex of the initial input mesh (it is the case for vertices such as
|
||||
* corners for example). Thus, this class can be specialized into two classes, the TVertex class
|
||||
* and the NonTVertex class.
|
||||
*/
|
||||
class ViewVertex : public Interface0D {
|
||||
public: // Implementation of Interface0D
|
||||
@@ -348,8 +348,8 @@ class ViewVertex : public Interface0D {
|
||||
|
||||
public:
|
||||
/* iterators access */
|
||||
// allows iteration on the edges that comes from/goes to this vertex in CCW order (order defined in 2D in the
|
||||
// image plan)
|
||||
// allows iteration on the edges that comes from/goes to this vertex in CCW order (order defined
|
||||
// in 2D in the image plan)
|
||||
virtual edge_iterator edges_begin() = 0;
|
||||
virtual const_edge_iterator edges_begin() const = 0;
|
||||
virtual edge_iterator edges_end() = 0;
|
||||
@@ -358,13 +358,14 @@ class ViewVertex : public Interface0D {
|
||||
virtual const_edge_iterator edges_iterator(ViewEdge *iEdge) const = 0;
|
||||
|
||||
// Iterator access
|
||||
/*! Returns an iterator over the ViewEdges that goes to or comes from this ViewVertex pointing to the first
|
||||
* ViewEdge of the list. The orientedViewEdgeIterator allows to iterate in CCW order over these ViewEdges
|
||||
* and to get the orientation for each ViewEdge (incoming/outgoing).
|
||||
/*! Returns an iterator over the ViewEdges that goes to or comes from this ViewVertex pointing to
|
||||
* the first ViewEdge of the list. The orientedViewEdgeIterator allows to iterate in CCW order
|
||||
* over these ViewEdges and to get the orientation for each ViewEdge (incoming/outgoing).
|
||||
*/
|
||||
virtual ViewVertexInternal::orientedViewEdgeIterator edgesBegin() = 0;
|
||||
|
||||
/*! Returns an orientedViewEdgeIterator over the ViewEdges around this ViewVertex, pointing after the last ViewEdge.
|
||||
/*! Returns an orientedViewEdgeIterator over the ViewEdges around this ViewVertex, pointing after
|
||||
* the last ViewEdge.
|
||||
*/
|
||||
virtual ViewVertexInternal::orientedViewEdgeIterator edgesEnd() = 0;
|
||||
|
||||
@@ -477,7 +478,8 @@ class TVertex : public ViewVertex {
|
||||
directedViewEdge _FrontEdgeB;
|
||||
directedViewEdge _BackEdgeA;
|
||||
directedViewEdge _BackEdgeB;
|
||||
Id _Id; // id to identify t vertices . these id will be negative in order not to be mixed with NonTVertex ids.
|
||||
Id _Id; // id to identify t vertices . these id will be negative in order not to be mixed with
|
||||
// NonTVertex ids.
|
||||
edge_pointers_container
|
||||
_sortedEdges; // the list of the four ViewEdges, ordered in CCW order (in the image plan)
|
||||
|
||||
@@ -606,8 +608,8 @@ class TVertex : public ViewVertex {
|
||||
virtual void Replace(ViewEdge *iOld, ViewEdge *iNew);
|
||||
|
||||
/*! returns the mate edge of iEdgeA.
|
||||
* For example, if iEdgeA is frontEdgeA, then frontEdgeB is returned. If iEdgeA is frontEdgeB then frontEdgeA
|
||||
* is returned. Same for back edges
|
||||
* For example, if iEdgeA is frontEdgeA, then frontEdgeB is returned. If iEdgeA is frontEdgeB
|
||||
* then frontEdgeA is returned. Same for back edges
|
||||
*/
|
||||
virtual ViewEdge *mate(ViewEdge *iEdgeA)
|
||||
{
|
||||
@@ -630,13 +632,14 @@ class TVertex : public ViewVertex {
|
||||
virtual edge_iterator edges_iterator(ViewEdge *iEdge);
|
||||
virtual const_edge_iterator edges_iterator(ViewEdge *iEdge) const;
|
||||
|
||||
/*! Returns an iterator over the ViewEdges that goes to or comes from this ViewVertex pointing to the first
|
||||
* ViewEdge of the list. The orientedViewEdgeIterator allows to iterate in CCW order over these ViewEdges
|
||||
* and to get the orientation for each ViewEdge (incoming/outgoing).
|
||||
/*! Returns an iterator over the ViewEdges that goes to or comes from this ViewVertex pointing to
|
||||
* the first ViewEdge of the list. The orientedViewEdgeIterator allows to iterate in CCW order
|
||||
* over these ViewEdges and to get the orientation for each ViewEdge (incoming/outgoing).
|
||||
*/
|
||||
virtual ViewVertexInternal::orientedViewEdgeIterator edgesBegin();
|
||||
|
||||
/*! Returns an orientedViewEdgeIterator over the ViewEdges around this ViewVertex, pointing after the last ViewEdge.
|
||||
/*! Returns an orientedViewEdgeIterator over the ViewEdges around this ViewVertex, pointing after
|
||||
* the last ViewEdge.
|
||||
*/
|
||||
virtual ViewVertexInternal::orientedViewEdgeIterator edgesEnd();
|
||||
|
||||
@@ -847,13 +850,14 @@ class NonTVertex : public ViewVertex {
|
||||
virtual edge_iterator edges_iterator(ViewEdge *iEdge);
|
||||
virtual const_edge_iterator edges_iterator(ViewEdge *iEdge) const;
|
||||
|
||||
/*! Returns an iterator over the ViewEdges that goes to or comes from this ViewVertex pointing to the first
|
||||
* ViewEdge of the list. The orientedViewEdgeIterator allows to iterate in CCW order over these ViewEdges
|
||||
* and to get the orientation for each ViewEdge (incoming/outgoing).
|
||||
/*! Returns an iterator over the ViewEdges that goes to or comes from this ViewVertex pointing to
|
||||
* the first ViewEdge of the list. The orientedViewEdgeIterator allows to iterate in CCW order
|
||||
* over these ViewEdges and to get the orientation for each ViewEdge (incoming/outgoing).
|
||||
*/
|
||||
virtual ViewVertexInternal::orientedViewEdgeIterator edgesBegin();
|
||||
|
||||
/*! Returns an orientedViewEdgeIterator over the ViewEdges around this ViewVertex, pointing after the last ViewEdge.
|
||||
/*! Returns an orientedViewEdgeIterator over the ViewEdges around this ViewVertex, pointing after
|
||||
* the last ViewEdge.
|
||||
*/
|
||||
virtual ViewVertexInternal::orientedViewEdgeIterator edgesEnd();
|
||||
|
||||
@@ -891,8 +895,8 @@ template<class Traits> class vertex_iterator_base;
|
||||
|
||||
} // end of namespace ViewEdgeInternal
|
||||
|
||||
/*! Class defining a ViewEdge. A ViewEdge in an edge of the image graph. it connects two ViewVertex.
|
||||
* It is made by connecting a set of FEdges.
|
||||
/*! Class defining a ViewEdge. A ViewEdge in an edge of the image graph. it connects two
|
||||
* ViewVertex. It is made by connecting a set of FEdges.
|
||||
*/
|
||||
class ViewEdge : public Interface1D {
|
||||
public: // Implementation of Interface0D
|
||||
@@ -937,9 +941,9 @@ class ViewEdge : public Interface1D {
|
||||
FEdge *_FEdgeB; // last edge of the embedded fedges chain
|
||||
Id _Id;
|
||||
unsigned _ChainingTimeStamp;
|
||||
// The silhouette view edge separates 2 2D spaces. The one on the left is necessarly the Shape _Shape (the one to
|
||||
// which this edge belongs to) and _aShape is the one on its right
|
||||
// NOT HANDLED BY THE COPY CONSTRUCTOR
|
||||
// The silhouette view edge separates 2 2D spaces. The one on the left is necessarly the Shape
|
||||
// _Shape (the one to which this edge belongs to) and _aShape is the one on its right NOT HANDLED
|
||||
// BY THE COPY CONSTRUCTOR
|
||||
ViewShape *_aShape;
|
||||
int _qi;
|
||||
vector<ViewShape *> _Occluders;
|
||||
@@ -1016,7 +1020,7 @@ class ViewEdge : public Interface1D {
|
||||
UpdateFEdges(); // tells every FEdge between iFEdgeA and iFEdgeB that this is theit ViewEdge
|
||||
}
|
||||
|
||||
//soc protected:
|
||||
// soc protected:
|
||||
/*! Copy constructor. */
|
||||
inline ViewEdge(ViewEdge &iBrother)
|
||||
{
|
||||
@@ -1091,9 +1095,8 @@ class ViewEdge : public Interface1D {
|
||||
return _Shape;
|
||||
}
|
||||
|
||||
/*! Returns the shape that is occluded by the ViewShape to which this ViewEdge belongs to. If no object is occluded,
|
||||
* NULL is returned.
|
||||
* \return The occluded ViewShape.
|
||||
/*! Returns the shape that is occluded by the ViewShape to which this ViewEdge belongs to. If no
|
||||
* object is occluded, NULL is returned. \return The occluded ViewShape.
|
||||
*/
|
||||
inline ViewShape *aShape()
|
||||
{
|
||||
@@ -1316,7 +1319,7 @@ class ViewEdge : public Interface1D {
|
||||
return false;
|
||||
}
|
||||
|
||||
//inline real z_discontinuity(int iCombination = 0) const;
|
||||
// inline real z_discontinuity(int iCombination = 0) const;
|
||||
|
||||
inline Id shape_id() const
|
||||
{
|
||||
@@ -1353,25 +1356,24 @@ class ViewEdge : public Interface1D {
|
||||
vertex_iterator vertices_end();
|
||||
|
||||
// Iterator access (Interface1D)
|
||||
/*! Returns an Interface0DIterator to iterate over the SVertex constituting the embedding of this ViewEdge.
|
||||
* The returned Interface0DIterator points to the first SVertex of the ViewEdge.
|
||||
/*! Returns an Interface0DIterator to iterate over the SVertex constituting the embedding of this
|
||||
* ViewEdge. The returned Interface0DIterator points to the first SVertex of the ViewEdge.
|
||||
*/
|
||||
virtual Interface0DIterator verticesBegin();
|
||||
|
||||
/*! Returns an Interface0DIterator to iterate over the SVertex constituting the embedding of this ViewEdge.
|
||||
* The returned Interface0DIterator points after the last SVertex of the ViewEdge.
|
||||
/*! Returns an Interface0DIterator to iterate over the SVertex constituting the embedding of this
|
||||
* ViewEdge. The returned Interface0DIterator points after the last SVertex of the ViewEdge.
|
||||
*/
|
||||
virtual Interface0DIterator verticesEnd();
|
||||
|
||||
/*! Returns an Interface0DIterator to iterate over the points of this ViewEdge at a given resolution.
|
||||
* The returned Interface0DIterator points on the first Point of the ViewEdge.
|
||||
* \param t:
|
||||
* the sampling value.
|
||||
/*! Returns an Interface0DIterator to iterate over the points of this ViewEdge at a given
|
||||
* resolution. The returned Interface0DIterator points on the first Point of the ViewEdge. \param
|
||||
* t: the sampling value.
|
||||
*/
|
||||
virtual Interface0DIterator pointsBegin(float t = 0.0f);
|
||||
|
||||
/*! Returns an Interface0DIterator to iterate over the points of this ViewEdge at a given resolution.
|
||||
* The returned Interface0DIterator points after the last Point of the ViewEdge.
|
||||
/*! Returns an Interface0DIterator to iterate over the points of this ViewEdge at a given
|
||||
* resolution. The returned Interface0DIterator points after the last Point of the ViewEdge.
|
||||
* \param t:
|
||||
* the sampling value.
|
||||
*/
|
||||
@@ -1390,7 +1392,8 @@ class ViewEdge : public Interface1D {
|
||||
/* */
|
||||
/**********************************/
|
||||
|
||||
/*! Class gathering the elements of the ViewMap (ViewVertex, ViewEdge) that are issued from the same input shape. */
|
||||
/*! Class gathering the elements of the ViewMap (ViewVertex, ViewEdge) that are issued from the
|
||||
* same input shape. */
|
||||
class ViewShape {
|
||||
private:
|
||||
vector<ViewVertex *> _Vertices;
|
||||
@@ -1520,11 +1523,10 @@ class ViewShape {
|
||||
* The FEdge that gets splitted
|
||||
* iViewVertices
|
||||
* The view vertices corresponding to the different intersections for the edge fe.
|
||||
* This list need to be sorted such as the first view vertex is the farther away from fe->vertexA.
|
||||
* ioNewEdges
|
||||
* The feature edges that are newly created (the initial edges are not included) are added to this list.
|
||||
* ioNewViewEdges
|
||||
* The view edges that are newly created (the initial edges are not included) are added to this list.
|
||||
* This list need to be sorted such as the first view vertex is the farther away from
|
||||
* fe->vertexA. ioNewEdges The feature edges that are newly created (the initial edges are not
|
||||
* included) are added to this list. ioNewViewEdges The view edges that are newly created (the
|
||||
* initial edges are not included) are added to this list.
|
||||
*/
|
||||
inline void SplitEdge(FEdge *fe,
|
||||
const vector<TVertex *> &iViewVertices,
|
||||
@@ -1608,7 +1610,8 @@ class ViewShape {
|
||||
//_SShape->AddNewEdge(iEdge->fedge());
|
||||
}
|
||||
|
||||
/* removes the view edge iViewEdge in the View Shape and the associated FEdge chain entry in the underlying SShape
|
||||
/* removes the view edge iViewEdge in the View Shape and the associated FEdge chain entry in the
|
||||
* underlying SShape
|
||||
*/
|
||||
void RemoveEdge(ViewEdge *iViewEdge);
|
||||
|
||||
@@ -1681,28 +1684,30 @@ void ViewShape::SplitEdge(FEdge *fe,
|
||||
ViewEdge *newVEdge;
|
||||
|
||||
if ((vva == 0) || (vvb == 0)) { // that means we're dealing with a closed viewedge (loop)
|
||||
// remove the chain that was starting by the fedge A of vEdge (which is different from fe !!!!)
|
||||
// remove the chain that was starting by the fedge A of vEdge (which is different from fe
|
||||
// !!!!)
|
||||
shape->RemoveEdgeFromChain(vEdge->fedgeA());
|
||||
// we set
|
||||
vEdge->setA(*vv);
|
||||
vEdge->setB(*vv);
|
||||
vEdge->setFEdgeA(newEdge);
|
||||
//FEdge *previousEdge = newEdge->previousEdge();
|
||||
// FEdge *previousEdge = newEdge->previousEdge();
|
||||
vEdge->setFEdgeB(fe);
|
||||
newVEdge = vEdge;
|
||||
vEdge->fedgeA()->setViewEdge(newVEdge);
|
||||
}
|
||||
else {
|
||||
// while we create the view edge, it updates the "ViewEdge" pointer of every underlying FEdges to this.
|
||||
// while we create the view edge, it updates the "ViewEdge" pointer of every underlying
|
||||
// FEdges to this.
|
||||
newVEdge = new ViewEdge((*vv), vvb); //, newEdge, vEdge->fedgeB());
|
||||
newVEdge->setNature((fe)->getNature());
|
||||
newVEdge->setFEdgeA(newEdge);
|
||||
//newVEdge->setFEdgeB(fe);
|
||||
// newVEdge->setFEdgeB(fe);
|
||||
// If our original viewedge is made of one FEdge, then
|
||||
if ((vEdge->fedgeA() == vEdge->fedgeB()) || (fe == vEdge->fedgeB()))
|
||||
newVEdge->setFEdgeB(newEdge);
|
||||
else
|
||||
newVEdge->setFEdgeB(vEdge->fedgeB()); //MODIF
|
||||
newVEdge->setFEdgeB(vEdge->fedgeB()); // MODIF
|
||||
|
||||
Id *newId = vEdge->splittingId();
|
||||
if (newId == 0) {
|
||||
@@ -1728,7 +1733,7 @@ void ViewShape::SplitEdge(FEdge *fe,
|
||||
|
||||
// we split the view edge:
|
||||
vEdge->setB((*vv));
|
||||
vEdge->setFEdgeB(fe); //MODIF
|
||||
vEdge->setFEdgeB(fe); // MODIF
|
||||
|
||||
// Update fedges so that they point to the new viewedge:
|
||||
newVEdge->UpdateFEdges();
|
||||
|
||||
@@ -165,7 +165,7 @@ class edge_iterator_base : public IteratorBase<Traits, InputIteratorTag_Traits>
|
||||
{
|
||||
}
|
||||
|
||||
//protected://FIXME
|
||||
// protected://FIXME
|
||||
public:
|
||||
#if 0
|
||||
inline edge_iterator_base(
|
||||
@@ -208,7 +208,7 @@ class edge_iterator_base : public IteratorBase<Traits, InputIteratorTag_Traits>
|
||||
{
|
||||
if (_Nature & Nature::T_VERTEX)
|
||||
return (_tvertex_iter == _tbegin);
|
||||
//return (_tvertex_iter == _feA);
|
||||
// return (_tvertex_iter == _feA);
|
||||
else
|
||||
return (_nontvertex_iter == _begin);
|
||||
}
|
||||
@@ -216,7 +216,7 @@ class edge_iterator_base : public IteratorBase<Traits, InputIteratorTag_Traits>
|
||||
virtual bool end() const
|
||||
{
|
||||
if (_Nature & Nature::T_VERTEX)
|
||||
//return (_tvertex_iter.first == 0);
|
||||
// return (_tvertex_iter.first == 0);
|
||||
return (_tvertex_iter == _tend);
|
||||
else
|
||||
return (_nontvertex_iter == _end);
|
||||
@@ -257,7 +257,7 @@ class edge_iterator_base : public IteratorBase<Traits, InputIteratorTag_Traits>
|
||||
virtual reference operator*() const
|
||||
{
|
||||
if (_Nature & Nature::T_VERTEX)
|
||||
//return _tvertex_iter;
|
||||
// return _tvertex_iter;
|
||||
return **_tvertex_iter;
|
||||
else
|
||||
return (*_nontvertex_iter);
|
||||
@@ -362,8 +362,8 @@ class edge_iterator_base : public IteratorBase<Traits, BidirectionalIteratorTag_
|
||||
|
||||
public:
|
||||
mutable value_type _ViewEdge;
|
||||
//friend class edge_iterator_base<Nonconst_traits<ViewEdge*> >;
|
||||
//friend class edge_iterator_base<Const_traits<ViewEdge*> >;
|
||||
// friend class edge_iterator_base<Nonconst_traits<ViewEdge*> >;
|
||||
// friend class edge_iterator_base<Const_traits<ViewEdge*> >;
|
||||
value_type _first;
|
||||
bool _orientation;
|
||||
typedef IteratorBase<Traits, BidirectionalIteratorTag_Traits> parent_class;
|
||||
@@ -392,7 +392,7 @@ class edge_iterator_base : public IteratorBase<Traits, BidirectionalIteratorTag_
|
||||
_orientation = iBrother._orientation;
|
||||
}
|
||||
|
||||
//protected://FIXME
|
||||
// protected://FIXME
|
||||
public:
|
||||
inline edge_iterator_base(value_type iEdge, bool orientation = true) : parent_class()
|
||||
{
|
||||
@@ -550,7 +550,7 @@ class fedge_iterator_base : public IteratorBase<Traits, BidirectionalIteratorTag
|
||||
_FEdgeB = iBrother._FEdgeB;
|
||||
}
|
||||
|
||||
//protected://FIXME
|
||||
// protected://FIXME
|
||||
public:
|
||||
inline fedge_iterator_base(value_type iEdge, value_type iFEdgeB) : parent_class()
|
||||
{
|
||||
@@ -687,7 +687,7 @@ class vertex_iterator_base : public IteratorBase<Traits, BidirectionalIteratorTa
|
||||
_PreviousFEdge = iBrother._PreviousFEdge;
|
||||
}
|
||||
|
||||
//protected://FIXME
|
||||
// protected://FIXME
|
||||
public:
|
||||
inline vertex_iterator_base(value_type iVertex, FEdge *iPreviousFEdge, FEdge *iNextFEdge)
|
||||
: parent_class()
|
||||
|
||||
@@ -125,7 +125,7 @@ static void findOccludee(FEdge *fe,
|
||||
else {
|
||||
// check whether the edge and the polygon plane are coincident:
|
||||
//-------------------------------------------------------------
|
||||
//first let us compute the plane equation.
|
||||
// first let us compute the plane equation.
|
||||
if (GeomUtils::COINCIDENT ==
|
||||
GeomUtils::intersectRayPlane(origin, edgeDir, p->getNormal(), d, t, epsilon)) {
|
||||
#if LOGGING
|
||||
@@ -255,8 +255,9 @@ static int computeVisibility(ViewMap *viewMap,
|
||||
I occluders(grid, center, epsilon);
|
||||
|
||||
for (occluders.initBeforeTarget(); occluders.validBeforeTarget(); occluders.nextOccluder()) {
|
||||
// If we're dealing with an exact silhouette, check whether we must take care of this occluder of not.
|
||||
// (Indeed, we don't consider the occluders that share at least one vertex with the face containing this edge).
|
||||
// If we're dealing with an exact silhouette, check whether we must take care of this occluder
|
||||
// of not. (Indeed, we don't consider the occluders that share at least one vertex with the
|
||||
// face containing this edge).
|
||||
//-----------
|
||||
oface = occluders.getWFace();
|
||||
Polygon3r *p = occluders.getCameraSpacePolygon();
|
||||
@@ -324,8 +325,8 @@ static int computeVisibility(ViewMap *viewMap,
|
||||
continue;
|
||||
|
||||
WFace *sface = (*ie)->GetbFace();
|
||||
//WFace *sfacea = (*ie)->GetaFace();
|
||||
//if ((sface == oface) || (sfacea == oface))
|
||||
// WFace *sfacea = (*ie)->GetaFace();
|
||||
// if ((sface == oface) || (sfacea == oface))
|
||||
if (sface == oface) {
|
||||
skipFace = true;
|
||||
break;
|
||||
@@ -346,7 +347,7 @@ static int computeVisibility(ViewMap *viewMap,
|
||||
else {
|
||||
// check whether the edge and the polygon plane are coincident:
|
||||
//-------------------------------------------------------------
|
||||
//first let us compute the plane equation.
|
||||
// first let us compute the plane equation.
|
||||
if (GeomUtils::COINCIDENT ==
|
||||
GeomUtils::intersectRayPlane(origin, edgeDir, p->getNormal(), d, t, epsilon)) {
|
||||
#if LOGGING
|
||||
@@ -412,11 +413,12 @@ static int computeVisibility(ViewMap *viewMap,
|
||||
|
||||
// computeCumulativeVisibility returns the lowest x such that the majority of FEdges have QI <= x
|
||||
//
|
||||
// This was probably the original intention of the "normal" algorithm on which computeDetailedVisibility is based.
|
||||
// But because the "normal" algorithm chooses the most popular QI, without considering any other values, a ViewEdge
|
||||
// with FEdges having QIs of 0, 21, 22, 23, 24 and 25 will end up having a total QI of 0, even though most of the
|
||||
// FEdges are heavily occluded. computeCumulativeVisibility will treat this case as a QI of 22 because 3 out of
|
||||
// 6 occluders have QI <= 22.
|
||||
// This was probably the original intention of the "normal" algorithm on which
|
||||
// computeDetailedVisibility is based. But because the "normal" algorithm chooses the most popular
|
||||
// QI, without considering any other values, a ViewEdge with FEdges having QIs of 0, 21, 22, 23, 24
|
||||
// and 25 will end up having a total QI of 0, even though most of the FEdges are heavily occluded.
|
||||
// computeCumulativeVisibility will treat this case as a QI of 22 because 3 out of 6 occluders have
|
||||
// QI <= 22.
|
||||
|
||||
template<typename G, typename I>
|
||||
static void computeCumulativeVisibility(ViewMap *ioViewMap,
|
||||
@@ -513,7 +515,7 @@ static void computeCumulativeVisibility(ViewMap *ioViewMap,
|
||||
continue;
|
||||
}
|
||||
if ((maxCard < qiMajority)) {
|
||||
//ARB: change &wFace to wFace and use reference in called function
|
||||
// ARB: change &wFace to wFace and use reference in called function
|
||||
tmpQI = computeVisibility<G, I>(
|
||||
ioViewMap, fe, grid, epsilon, *ve, &wFace, &foundOccluders);
|
||||
#if LOGGING
|
||||
@@ -522,11 +524,11 @@ static void computeCumulativeVisibility(ViewMap *ioViewMap,
|
||||
}
|
||||
#endif
|
||||
|
||||
//ARB: This is an error condition, not an alert condition.
|
||||
// ARB: This is an error condition, not an alert condition.
|
||||
// Some sort of recovery or abort is necessary.
|
||||
if (tmpQI >= 256) {
|
||||
cerr << "Warning: too many occluding levels" << endl;
|
||||
//ARB: Wild guess: instead of aborting or corrupting memory, treat as tmpQI == 255
|
||||
// ARB: Wild guess: instead of aborting or corrupting memory, treat as tmpQI == 255
|
||||
tmpQI = 255;
|
||||
}
|
||||
|
||||
@@ -536,8 +538,8 @@ static void computeCumulativeVisibility(ViewMap *ioViewMap,
|
||||
}
|
||||
}
|
||||
else {
|
||||
//ARB: FindOccludee is redundant if ComputeRayCastingVisibility has been called
|
||||
//ARB: change &wFace to wFace and use reference in called function
|
||||
// ARB: FindOccludee is redundant if ComputeRayCastingVisibility has been called
|
||||
// ARB: change &wFace to wFace and use reference in called function
|
||||
findOccludee<G, I>(fe, grid, epsilon, *ve, &wFace);
|
||||
#if LOGGING
|
||||
if (_global.debug & G_DEBUG_FREESTYLE) {
|
||||
@@ -589,8 +591,8 @@ static void computeCumulativeVisibility(ViewMap *ioViewMap,
|
||||
}
|
||||
}
|
||||
// occluders --
|
||||
// I would rather not have to go through the effort of creating this set and then copying out its contents.
|
||||
// Is there a reason why ViewEdge::_Occluders cannot be converted to a set<>?
|
||||
// I would rather not have to go through the effort of creating this set and then copying out
|
||||
// its contents. Is there a reason why ViewEdge::_Occluders cannot be converted to a set<>?
|
||||
for (set<ViewShape *>::iterator o = foundOccluders.begin(), oend = foundOccluders.end();
|
||||
o != oend;
|
||||
++o) {
|
||||
@@ -710,7 +712,7 @@ static void computeDetailedVisibility(ViewMap *ioViewMap,
|
||||
continue;
|
||||
}
|
||||
if ((maxCard < qiMajority)) {
|
||||
//ARB: change &wFace to wFace and use reference in called function
|
||||
// ARB: change &wFace to wFace and use reference in called function
|
||||
tmpQI = computeVisibility<G, I>(
|
||||
ioViewMap, fe, grid, epsilon, *ve, &wFace, &foundOccluders);
|
||||
#if LOGGING
|
||||
@@ -719,11 +721,11 @@ static void computeDetailedVisibility(ViewMap *ioViewMap,
|
||||
}
|
||||
#endif
|
||||
|
||||
//ARB: This is an error condition, not an alert condition.
|
||||
// ARB: This is an error condition, not an alert condition.
|
||||
// Some sort of recovery or abort is necessary.
|
||||
if (tmpQI >= 256) {
|
||||
cerr << "Warning: too many occluding levels" << endl;
|
||||
//ARB: Wild guess: instead of aborting or corrupting memory, treat as tmpQI == 255
|
||||
// ARB: Wild guess: instead of aborting or corrupting memory, treat as tmpQI == 255
|
||||
tmpQI = 255;
|
||||
}
|
||||
|
||||
@@ -733,8 +735,8 @@ static void computeDetailedVisibility(ViewMap *ioViewMap,
|
||||
}
|
||||
}
|
||||
else {
|
||||
//ARB: FindOccludee is redundant if ComputeRayCastingVisibility has been called
|
||||
//ARB: change &wFace to wFace and use reference in called function
|
||||
// ARB: FindOccludee is redundant if ComputeRayCastingVisibility has been called
|
||||
// ARB: change &wFace to wFace and use reference in called function
|
||||
findOccludee<G, I>(fe, grid, epsilon, *ve, &wFace);
|
||||
#if LOGGING
|
||||
if (_global.debug & G_DEBUG_FREESTYLE) {
|
||||
@@ -779,8 +781,8 @@ static void computeDetailedVisibility(ViewMap *ioViewMap,
|
||||
// qi --
|
||||
(*ve)->setQI(maxIndex);
|
||||
// occluders --
|
||||
// I would rather not have to go through the effort of creating this this set and then copying out its contents.
|
||||
// Is there a reason why ViewEdge::_Occluders cannot be converted to a set<>?
|
||||
// I would rather not have to go through the effort of creating this this set and then copying
|
||||
// out its contents. Is there a reason why ViewEdge::_Occluders cannot be converted to a set<>?
|
||||
for (set<ViewShape *>::iterator o = foundOccluders.begin(), oend = foundOccluders.end();
|
||||
o != oend;
|
||||
++o) {
|
||||
@@ -877,15 +879,15 @@ static void computeFastVisibility(ViewMap *ioViewMap, G &grid, real epsilon)
|
||||
}
|
||||
if (even_test) {
|
||||
if ((maxCard < qiMajority)) {
|
||||
//ARB: change &wFace to wFace and use reference in called function
|
||||
// ARB: change &wFace to wFace and use reference in called function
|
||||
tmpQI = computeVisibility<G, I>(
|
||||
ioViewMap, fe, grid, epsilon, *ve, &wFace, &foundOccluders);
|
||||
|
||||
//ARB: This is an error condition, not an alert condition.
|
||||
// ARB: This is an error condition, not an alert condition.
|
||||
// Some sort of recovery or abort is necessary.
|
||||
if (tmpQI >= 256) {
|
||||
cerr << "Warning: too many occluding levels" << endl;
|
||||
//ARB: Wild guess: instead of aborting or corrupting memory, treat as tmpQI == 255
|
||||
// ARB: Wild guess: instead of aborting or corrupting memory, treat as tmpQI == 255
|
||||
tmpQI = 255;
|
||||
}
|
||||
|
||||
@@ -895,8 +897,8 @@ static void computeFastVisibility(ViewMap *ioViewMap, G &grid, real epsilon)
|
||||
}
|
||||
}
|
||||
else {
|
||||
//ARB: FindOccludee is redundant if ComputeRayCastingVisibility has been called
|
||||
//ARB: change &wFace to wFace and use reference in called function
|
||||
// ARB: FindOccludee is redundant if ComputeRayCastingVisibility has been called
|
||||
// ARB: change &wFace to wFace and use reference in called function
|
||||
findOccludee<G, I>(fe, grid, epsilon, *ve, &wFace);
|
||||
}
|
||||
|
||||
@@ -1008,7 +1010,8 @@ void ViewMapBuilder::BuildGrid(WingedEdge &we, const BBox<Vec3r> &bbox, unsigned
|
||||
Vec3r size;
|
||||
for (unsigned int i = 0; i < 3; i++) {
|
||||
size[i] = fabs(bbox.getMax()[i] - bbox.getMin()[i]);
|
||||
// let make the grid 1/10 bigger to avoid numerical errors while computing triangles/cells intersections.
|
||||
// let make the grid 1/10 bigger to avoid numerical errors while computing triangles/cells
|
||||
// intersections.
|
||||
size[i] += size[i] / 10.0;
|
||||
if (size[i] == 0) {
|
||||
if (_global.debug & G_DEBUG_FREESTYLE) {
|
||||
@@ -1083,8 +1086,8 @@ void ViewMapBuilder::CullViewEdges(ViewMap *ioViewMap,
|
||||
|
||||
// Non-displayable view edges will be skipped over during visibility calculation.
|
||||
|
||||
// View edges will be culled according to their position w.r.t. the viewport proscenium (viewport + 5% border,
|
||||
// or some such).
|
||||
// View edges will be culled according to their position w.r.t. the viewport proscenium (viewport
|
||||
// + 5% border, or some such).
|
||||
|
||||
// Get proscenium boundary for culling
|
||||
GridHelpers::getDefaultViewProscenium(viewProscenium);
|
||||
@@ -1098,17 +1101,16 @@ void ViewMapBuilder::CullViewEdges(ViewMap *ioViewMap,
|
||||
cout << "Origin: [" << prosceniumOrigin[0] << ", " << prosceniumOrigin[1] << "]" << endl;
|
||||
}
|
||||
|
||||
// A separate occluder proscenium will also be maintained, starting out the same as the viewport proscenium, and
|
||||
// expanding as necessary so that it encompasses the center point of at least one feature edge in each retained view
|
||||
// edge.
|
||||
// The occluder proscenium will be used later to cull occluding triangles before they are inserted into the Grid.
|
||||
// The occluder proscenium starts out the same size as the view proscenium
|
||||
// A separate occluder proscenium will also be maintained, starting out the same as the viewport
|
||||
// proscenium, and expanding as necessary so that it encompasses the center point of at least one
|
||||
// feature edge in each retained view edge. The occluder proscenium will be used later to cull
|
||||
// occluding triangles before they are inserted into the Grid. The occluder proscenium starts out
|
||||
// the same size as the view proscenium
|
||||
GridHelpers::getDefaultViewProscenium(occluderProscenium);
|
||||
|
||||
// N.B. Freestyle is inconsistent in its use of ViewMap::viewedges_container and vector<ViewEdge*>::iterator.
|
||||
// Probably all occurences of vector<ViewEdge*>::iterator should be replaced ViewMap::viewedges_container
|
||||
// throughout the code.
|
||||
// For each view edge
|
||||
// N.B. Freestyle is inconsistent in its use of ViewMap::viewedges_container and
|
||||
// vector<ViewEdge*>::iterator. Probably all occurences of vector<ViewEdge*>::iterator should be
|
||||
// replaced ViewMap::viewedges_container throughout the code. For each view edge
|
||||
ViewMap::viewedges_container::iterator ve, veend;
|
||||
|
||||
for (ve = ioViewMap->ViewEdges().begin(), veend = ioViewMap->ViewEdges().end(); ve != veend;
|
||||
@@ -1130,8 +1132,8 @@ void ViewMapBuilder::CullViewEdges(ViewMap *ioViewMap,
|
||||
// All ViewEdges start culled
|
||||
(*ve)->setIsInImage(false);
|
||||
|
||||
// For simple visibility calculation: mark a feature edge that is known to have a center point inside the
|
||||
// occluder proscenium. Cull all other feature edges.
|
||||
// For simple visibility calculation: mark a feature edge that is known to have a center point
|
||||
// inside the occluder proscenium. Cull all other feature edges.
|
||||
do {
|
||||
// All FEdges start culled
|
||||
fe->setIsInImage(false);
|
||||
@@ -1165,15 +1167,15 @@ void ViewMapBuilder::CullViewEdges(ViewMap *ioViewMap,
|
||||
fe = fe->nextEdge();
|
||||
} while (fe && fe != festart && !(bestOccluderTargetFound && (*ve)->isInImage()));
|
||||
|
||||
// Either we have run out of FEdges, or we already have the one edge we need to determine visibility
|
||||
// Cull all remaining edges.
|
||||
// Either we have run out of FEdges, or we already have the one edge we need to determine
|
||||
// visibility Cull all remaining edges.
|
||||
while (fe && fe != festart) {
|
||||
fe->setIsInImage(false);
|
||||
fe = fe->nextEdge();
|
||||
}
|
||||
|
||||
// If bestOccluderTarget was not found inside the occluder proscenium, we need to expand the occluder
|
||||
// proscenium to include it.
|
||||
// If bestOccluderTarget was not found inside the occluder proscenium, we need to expand the
|
||||
// occluder proscenium to include it.
|
||||
if ((*ve)->isInImage() && bestOccluderTarget != NULL && !bestOccluderTargetFound) {
|
||||
// Expand occluder proscenium to enclose bestOccluderTarget
|
||||
Vec3r point = bestOccluderTarget->center2d();
|
||||
@@ -1204,14 +1206,15 @@ void ViewMapBuilder::CullViewEdges(ViewMap *ioViewMap,
|
||||
|
||||
// For "Normal" or "Fast" style visibility computation only:
|
||||
|
||||
// For more detailed visibility calculation, make a second pass through the view map, marking all feature edges
|
||||
// with center points inside the final occluder proscenium. All of these feature edges can be considered during
|
||||
// visibility calculation.
|
||||
// For more detailed visibility calculation, make a second pass through the view map, marking all
|
||||
// feature edges with center points inside the final occluder proscenium. All of these feature
|
||||
// edges can be considered during visibility calculation.
|
||||
|
||||
// So far we have only found one FEdge per ViewEdge. The "Normal" and "Fast" styles of visibility computation
|
||||
// want to consider many FEdges for each ViewEdge.
|
||||
// Here we re-scan the view map to find any usable FEdges that we skipped on the first pass, or that have become
|
||||
// usable because the occluder proscenium has been expanded since the edge was visited on the first pass.
|
||||
// So far we have only found one FEdge per ViewEdge. The "Normal" and "Fast" styles of
|
||||
// visibility computation want to consider many FEdges for each ViewEdge. Here we re-scan the
|
||||
// view map to find any usable FEdges that we skipped on the first pass, or that have become
|
||||
// usable because the occluder proscenium has been expanded since the edge was visited on the
|
||||
// first pass.
|
||||
if (extensiveFEdgeSearch) {
|
||||
// For each view edge,
|
||||
for (ve = ioViewMap->ViewEdges().begin(), veend = ioViewMap->ViewEdges().end(); ve != veend;
|
||||
@@ -1465,15 +1468,15 @@ void ViewMapBuilder::ComputeEdgesVisibility(ViewMap *ioViewMap,
|
||||
ComputeDetailedVisibility(ioViewMap, we, bbox, epsilon, true, factory);
|
||||
}
|
||||
catch (...) {
|
||||
// Last resort catch to make sure RAII semantics hold for OptimizedGrid. Can be replaced with
|
||||
// try...catch block around main() if the program as a whole is converted to RAII
|
||||
// Last resort catch to make sure RAII semantics hold for OptimizedGrid. Can be replaced
|
||||
// with try...catch block around main() if the program as a whole is converted to RAII
|
||||
|
||||
// This is the little-mentioned caveat of RAII: RAII does not work unless destructors are always
|
||||
// called, but destructors are only called if all exceptions are caught (or std::terminate() is
|
||||
// replaced).
|
||||
// This is the little-mentioned caveat of RAII: RAII does not work unless destructors are
|
||||
// always called, but destructors are only called if all exceptions are caught (or
|
||||
// std::terminate() is replaced).
|
||||
|
||||
// We don't actually handle the exception here, so re-throw it now that our destructors have had a
|
||||
// chance to run.
|
||||
// We don't actually handle the exception here, so re-throw it now that our destructors
|
||||
// have had a chance to run.
|
||||
throw;
|
||||
}
|
||||
break;
|
||||
@@ -1591,11 +1594,11 @@ void ViewMapBuilder::ComputeRayCastingVisibility(ViewMap *ioViewMap, real epsilo
|
||||
cout << "\tFEdge: visibility " << tmpQI << endl;
|
||||
}
|
||||
#endif
|
||||
//ARB: This is an error condition, not an alert condition.
|
||||
// ARB: This is an error condition, not an alert condition.
|
||||
// Some sort of recovery or abort is necessary.
|
||||
if (tmpQI >= 256) {
|
||||
cerr << "Warning: too many occluding levels" << endl;
|
||||
//ARB: Wild guess: instead of aborting or corrupting memory, treat as tmpQI == 255
|
||||
// ARB: Wild guess: instead of aborting or corrupting memory, treat as tmpQI == 255
|
||||
tmpQI = 255;
|
||||
}
|
||||
|
||||
@@ -1605,7 +1608,7 @@ void ViewMapBuilder::ComputeRayCastingVisibility(ViewMap *ioViewMap, real epsilo
|
||||
}
|
||||
}
|
||||
else {
|
||||
//ARB: FindOccludee is redundant if ComputeRayCastingVisibility has been called
|
||||
// ARB: FindOccludee is redundant if ComputeRayCastingVisibility has been called
|
||||
FindOccludee(fe, _Grid, epsilon, &aFace, timestamp++);
|
||||
#if LOGGING
|
||||
if (_global.debug & G_DEBUG_FREESTYLE) {
|
||||
@@ -1626,7 +1629,8 @@ void ViewMapBuilder::ComputeRayCastingVisibility(ViewMap *ioViewMap, real epsilo
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
//ARB: We are arbitrarily using the last observed value for occludee (almost always the value observed
|
||||
// ARB: We are arbitrarily using the last observed value for occludee (almost always the
|
||||
// value observed
|
||||
// for the edge before festart). Is that meaningful?
|
||||
// ...in fact, _occludeeEmpty seems to be unused.
|
||||
fe->setOccludeeEmpty(true);
|
||||
@@ -1736,11 +1740,11 @@ void ViewMapBuilder::ComputeFastRayCastingVisibility(ViewMap *ioViewMap, real ep
|
||||
if ((maxCard < qiMajority)) {
|
||||
tmpQI = ComputeRayCastingVisibility(fe, _Grid, epsilon, occluders, &aFace, timestamp++);
|
||||
|
||||
//ARB: This is an error condition, not an alert condition.
|
||||
// ARB: This is an error condition, not an alert condition.
|
||||
// Some sort of recovery or abort is necessary.
|
||||
if (tmpQI >= 256) {
|
||||
cerr << "Warning: too many occluding levels" << endl;
|
||||
//ARB: Wild guess: instead of aborting or corrupting memory, treat as tmpQI == 255
|
||||
// ARB: Wild guess: instead of aborting or corrupting memory, treat as tmpQI == 255
|
||||
tmpQI = 255;
|
||||
}
|
||||
|
||||
@@ -1750,7 +1754,7 @@ void ViewMapBuilder::ComputeFastRayCastingVisibility(ViewMap *ioViewMap, real ep
|
||||
}
|
||||
}
|
||||
else {
|
||||
//ARB: FindOccludee is redundant if ComputeRayCastingVisibility has been called
|
||||
// ARB: FindOccludee is redundant if ComputeRayCastingVisibility has been called
|
||||
FindOccludee(fe, _Grid, epsilon, &aFace, timestamp++);
|
||||
}
|
||||
|
||||
@@ -1895,7 +1899,7 @@ void ViewMapBuilder::FindOccludee(FEdge *fe,
|
||||
for (p = occluders.begin(), pend = occluders.end(); p != pend; p++) {
|
||||
// check whether the edge and the polygon plane are coincident:
|
||||
//-------------------------------------------------------------
|
||||
//first let us compute the plane equation.
|
||||
// first let us compute the plane equation.
|
||||
oface = (WFace *)(*p)->userdata;
|
||||
Vec3r v1(((*p)->getVertices())[0]);
|
||||
Vec3r normal((*p)->getNormal());
|
||||
@@ -2022,7 +2026,7 @@ int ViewMapBuilder::ComputeRayCastingVisibility(FEdge *fe,
|
||||
(center.z() < gridOrigin.z()) || (center.x() > gridExtremity.x()) ||
|
||||
(center.y() > gridExtremity.y()) || (center.z() > gridExtremity.z())) {
|
||||
cerr << "Warning: point is out of the grid for fedge " << fe->getId() << endl;
|
||||
//return 0;
|
||||
// return 0;
|
||||
}
|
||||
|
||||
#if 0
|
||||
@@ -2073,8 +2077,9 @@ int ViewMapBuilder::ComputeRayCastingVisibility(FEdge *fe,
|
||||
face->RetrieveVertexList(faceVertices);
|
||||
|
||||
for (p = occluders.begin(), pend = occluders.end(); p != pend; p++) {
|
||||
// If we're dealing with an exact silhouette, check whether we must take care of this occluder of not.
|
||||
// (Indeed, we don't consider the occluders that share at least one vertex with the face containing this edge).
|
||||
// If we're dealing with an exact silhouette, check whether we must take care of this occluder
|
||||
// of not. (Indeed, we don't consider the occluders that share at least one vertex with the
|
||||
// face containing this edge).
|
||||
//-----------
|
||||
oface = (WFace *)(*p)->userdata;
|
||||
#if LOGGING
|
||||
@@ -2126,8 +2131,8 @@ int ViewMapBuilder::ComputeRayCastingVisibility(FEdge *fe,
|
||||
continue;
|
||||
|
||||
WFace *sface = (*ie)->GetbFace();
|
||||
//WFace *sfacea = (*ie)->GetaFace();
|
||||
//if ((sface == oface) || (sfacea == oface)) {
|
||||
// WFace *sfacea = (*ie)->GetaFace();
|
||||
// if ((sface == oface) || (sfacea == oface)) {
|
||||
if (sface == oface) {
|
||||
skipFace = true;
|
||||
break;
|
||||
@@ -2148,7 +2153,7 @@ int ViewMapBuilder::ComputeRayCastingVisibility(FEdge *fe,
|
||||
else {
|
||||
// check whether the edge and the polygon plane are coincident:
|
||||
//-------------------------------------------------------------
|
||||
//first let us compute the plane equation.
|
||||
// first let us compute the plane equation.
|
||||
|
||||
if (GeomUtils::COINCIDENT ==
|
||||
GeomUtils::intersectRayPlane(origin, edgeDir, normal, d, t, epsilon)) {
|
||||
|
||||
@@ -57,7 +57,7 @@ using namespace Geometry;
|
||||
class ViewMapBuilder {
|
||||
private:
|
||||
ViewMap *_ViewMap; // result
|
||||
//SilhouetteGeomEngine _GeomEngine;
|
||||
// SilhouetteGeomEngine _GeomEngine;
|
||||
ProgressBar *_pProgressBar;
|
||||
RenderMonitor *_pRenderMonitor;
|
||||
Vec3r _viewpoint;
|
||||
@@ -117,8 +117,8 @@ class ViewMapBuilder {
|
||||
/*! Compute Cusps */
|
||||
void computeCusps(ViewMap *ioViewMap);
|
||||
|
||||
/*! Detects cusps (for a single ViewEdge) among SVertices and builds a ViewVertex on top of each cusp SVertex
|
||||
* We use a hysteresis approach to avoid noise.
|
||||
/*! Detects cusps (for a single ViewEdge) among SVertices and builds a ViewVertex on top of each
|
||||
* cusp SVertex We use a hysteresis approach to avoid noise.
|
||||
*/
|
||||
void DetectCusps(ViewEdge *ioEdge);
|
||||
|
||||
@@ -174,10 +174,9 @@ class ViewMapBuilder {
|
||||
* ioViewMap
|
||||
* The view map. It is modified by the method.
|
||||
* The list of all features edges of the scene.
|
||||
* Each time an intersection is found, the 2 intersecting edges are splitted (creating 2 new vertices)
|
||||
* At the end, this list is updated with the adding of all new created edges (resulting from splitting).
|
||||
* iAlgo
|
||||
* The algo to use for computing the intersections
|
||||
* Each time an intersection is found, the 2 intersecting edges are splitted (creating 2 new
|
||||
* vertices) At the end, this list is updated with the adding of all new created edges (resulting
|
||||
* from splitting). iAlgo The algo to use for computing the intersections
|
||||
*/
|
||||
void ComputeIntersections(ViewMap *ioViewMap,
|
||||
intersection_algo iAlgo = sweep_line,
|
||||
@@ -221,14 +220,11 @@ class ViewMapBuilder {
|
||||
/*! Computes intersections on all edges of the scene using a sweep line algorithm */
|
||||
void ComputeSweepLineIntersections(ViewMap *ioViewMap, real epsilon = 1.0e-6);
|
||||
|
||||
/*! Computes the 2D scene silhouette edges visibility using a ray casting. On each edge, a ray is cast
|
||||
* to check its quantitative invisibility. The list of occluders are each time stored in the tested edge.
|
||||
* ioViewMap
|
||||
* The view map.
|
||||
* The 2D scene silhouette edges as FEdges.
|
||||
* These edges have already been splitted at their intersections points.
|
||||
* Thus, these edges do not intersect anymore.
|
||||
* The visibility corresponding to each edge of ioScene is set is this edge.
|
||||
/*! Computes the 2D scene silhouette edges visibility using a ray casting. On each edge, a ray is
|
||||
* cast to check its quantitative invisibility. The list of occluders are each time stored in the
|
||||
* tested edge. ioViewMap The view map. The 2D scene silhouette edges as FEdges. These edges have
|
||||
* already been splitted at their intersections points. Thus, these edges do not intersect
|
||||
* anymore. The visibility corresponding to each edge of ioScene is set is this edge.
|
||||
*/
|
||||
void ComputeRayCastingVisibility(ViewMap *ioViewMap, real epsilon = 1.0e-6);
|
||||
void ComputeFastRayCastingVisibility(ViewMap *ioViewMap, real epsilon = 1.0e-6);
|
||||
@@ -257,10 +253,10 @@ class ViewMapBuilder {
|
||||
* The epsilon used for computation
|
||||
* oShapeId
|
||||
* fe is the border (in 2D) between 2 2D spaces.
|
||||
* if fe is a silhouette, One of these 2D spaces is occupied by the shape to which fe belongs (on its left)
|
||||
* and the other one is either occupied by another shape or empty or occupied by the same shape.
|
||||
* We use this ray csating operation to determine which shape lies on fe's right.
|
||||
* The result is the shape id stored in oShapeId
|
||||
* if fe is a silhouette, One of these 2D spaces is occupied by the shape to which fe
|
||||
* belongs (on its left) and the other one is either occupied by another shape or empty or
|
||||
* occupied by the same shape. We use this ray csating operation to determine which shape lies on
|
||||
* fe's right. The result is the shape id stored in oShapeId
|
||||
*/
|
||||
int ComputeRayCastingVisibility(FEdge *fe,
|
||||
Grid *iGrid,
|
||||
|
||||
@@ -801,8 +801,8 @@ static int save(ostream &out, SVertex *sv)
|
||||
WRITE_IF_NON_NULL(sv->viewvertex());
|
||||
|
||||
// Normals (List)
|
||||
// Note: the 'size()' method of a set doesn't seem to return the actual size of the given set, so we have to
|
||||
// hack it...
|
||||
// Note: the 'size()' method of a set doesn't seem to return the actual size of the given set, so
|
||||
// we have to hack it...
|
||||
set<Vec3r>::const_iterator i;
|
||||
for (i = sv->normals().begin(), tmp = 0; i != sv->normals().end(); i++, tmp++)
|
||||
;
|
||||
@@ -955,7 +955,7 @@ int load(istream &in, ViewMap *vm, ProgressBar *pb)
|
||||
if (!vm)
|
||||
return 1;
|
||||
|
||||
//soc unused - unsigned tmp;
|
||||
// soc unused - unsigned tmp;
|
||||
int err = 0;
|
||||
Internal::g_vm = vm;
|
||||
|
||||
|
||||
@@ -46,10 +46,9 @@ namespace Freestyle {
|
||||
|
||||
namespace ViewVertexInternal {
|
||||
|
||||
/*! Class representing an iterator over oriented ViewEdges around a ViewVertex. This iterator allows a CCW iteration
|
||||
* (in the image plane).
|
||||
* An instance of an orientedViewEdgeIterator can only be obtained from a ViewVertex by calling edgesBegin()
|
||||
* or edgesEnd().
|
||||
/*! Class representing an iterator over oriented ViewEdges around a ViewVertex. This iterator
|
||||
* allows a CCW iteration (in the image plane). An instance of an orientedViewEdgeIterator can only
|
||||
* be obtained from a ViewVertex by calling edgesBegin() or edgesEnd().
|
||||
*/
|
||||
class orientedViewEdgeIterator : public Iterator {
|
||||
public:
|
||||
@@ -127,7 +126,8 @@ class orientedViewEdgeIterator : public Iterator {
|
||||
}
|
||||
|
||||
public:
|
||||
/*! Tells whether the ViewEdge pointed by this iterator is the first one of the iteration list or not. */
|
||||
/*! Tells whether the ViewEdge pointed by this iterator is the first one of the iteration list or
|
||||
* not. */
|
||||
virtual bool isBegin() const
|
||||
{
|
||||
if (_Nature & Nature::T_VERTEX)
|
||||
@@ -136,7 +136,8 @@ class orientedViewEdgeIterator : public Iterator {
|
||||
return (_nontvertex_iter == _begin);
|
||||
}
|
||||
|
||||
/*! Tells whether the ViewEdge pointed by this iterator is after the last one of the iteration list or not. */
|
||||
/*! Tells whether the ViewEdge pointed by this iterator is after the last one of the iteration
|
||||
* list or not. */
|
||||
virtual bool isEnd() const
|
||||
{
|
||||
if (_Nature & Nature::T_VERTEX)
|
||||
@@ -186,7 +187,7 @@ class orientedViewEdgeIterator : public Iterator {
|
||||
virtual ViewVertex::directedViewEdge &operator*() const
|
||||
{
|
||||
if (_Nature & Nature::T_VERTEX)
|
||||
//return _tvertex_iter;
|
||||
// return _tvertex_iter;
|
||||
return **_tvertex_iter;
|
||||
else
|
||||
return (*_nontvertex_iter);
|
||||
@@ -406,8 +407,8 @@ class SVertexIterator : public Interface0DIteratorNested {
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
/*! Base class for iterators over ViewEdges of the ViewMap Graph.
|
||||
* Basically the "increment()" operator of this class should be able to take the decision of "where" (on which
|
||||
* ViewEdge) to go when pointing on a given ViewEdge.
|
||||
* Basically the "increment()" operator of this class should be able to take the decision of
|
||||
* "where" (on which ViewEdge) to go when pointing on a given ViewEdge.
|
||||
* ::Caution::: the dereferencing operator returns a *pointer* to the pointed ViewEdge.
|
||||
*/
|
||||
class ViewEdgeIterator : public Iterator {
|
||||
@@ -416,8 +417,9 @@ class ViewEdgeIterator : public Iterator {
|
||||
* \param begin:
|
||||
* The ViewEdge from where to start the iteration.
|
||||
* \param orientation:
|
||||
* If true, we'll look for the next ViewEdge among the ViewEdges that surround the ending ViewVertex of begin.
|
||||
* If false, we'll search over the ViewEdges surrounding the ending ViewVertex of begin.
|
||||
* If true, we'll look for the next ViewEdge among the ViewEdges that surround the ending
|
||||
* ViewVertex of begin. If false, we'll search over the ViewEdges surrounding the ending
|
||||
* ViewVertex of begin.
|
||||
*/
|
||||
ViewEdgeIterator(ViewEdge *begin = NULL, bool orientation = true)
|
||||
{
|
||||
|
||||
@@ -57,11 +57,12 @@ class ViewMapTesselator {
|
||||
{
|
||||
}
|
||||
|
||||
/*! Builds a set of lines rep contained under a a NodeShape, itself contained under a NodeGroup from a ViewMap */
|
||||
/*! Builds a set of lines rep contained under a a NodeShape, itself contained under a NodeGroup
|
||||
* from a ViewMap */
|
||||
NodeGroup *Tesselate(ViewMap *iViewMap);
|
||||
|
||||
/*! Builds a set of lines rep contained under a a NodeShape, itself contained under a NodeGroup from a set of
|
||||
* view edges
|
||||
/*! Builds a set of lines rep contained under a a NodeShape, itself contained under a NodeGroup
|
||||
* from a set of view edges
|
||||
*/
|
||||
template<class ViewEdgesIterator>
|
||||
NodeGroup *Tesselate(ViewEdgesIterator begin, ViewEdgesIterator end);
|
||||
@@ -156,7 +157,7 @@ NodeGroup *ViewMapTesselator::Tesselate(ViewEdgesIterator begin, ViewEdgesIterat
|
||||
NodeGroup *group = new NodeGroup;
|
||||
NodeShape *tshape = new NodeShape;
|
||||
group->AddChild(tshape);
|
||||
//tshape->frs_material().setDiffuse(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
// tshape->frs_material().setDiffuse(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
tshape->setFrsMaterial(_FrsMaterial);
|
||||
|
||||
LineRep *line;
|
||||
@@ -165,7 +166,8 @@ NodeGroup *ViewMapTesselator::Tesselate(ViewEdgesIterator begin, ViewEdgesIterat
|
||||
FEdge *nextFEdge, *currentEdge;
|
||||
|
||||
int id = 0;
|
||||
//for (vector<ViewEdge*>::const_iterator c = viewedges.begin(), cend = viewedges.end(); c != cend; c++)
|
||||
// for (vector<ViewEdge*>::const_iterator c = viewedges.begin(), cend = viewedges.end(); c !=
|
||||
// cend; c++)
|
||||
for (ViewEdgesIterator c = begin, cend = end; c != cend; c++) {
|
||||
#if 0
|
||||
if ((*c)->qi() > 0) {
|
||||
@@ -189,25 +191,25 @@ NodeGroup *ViewMapTesselator::Tesselate(ViewEdgesIterator begin, ViewEdgesIterat
|
||||
// there might be chains containing a single element
|
||||
if (0 == (firstEdge)->nextEdge()) {
|
||||
line->setStyle(LineRep::LINES);
|
||||
//line->AddVertex((*c)->vertexA()->point3D());
|
||||
//line->AddVertex((*c)->vertexB()->point3D());
|
||||
// line->AddVertex((*c)->vertexA()->point3D());
|
||||
// line->AddVertex((*c)->vertexB()->point3D());
|
||||
AddVertexToLine(line, firstEdge->vertexA());
|
||||
AddVertexToLine(line, firstEdge->vertexB());
|
||||
}
|
||||
else {
|
||||
line->setStyle(LineRep::LINE_STRIP);
|
||||
|
||||
//firstEdge = (*c);
|
||||
// firstEdge = (*c);
|
||||
nextFEdge = firstEdge;
|
||||
currentEdge = firstEdge;
|
||||
do {
|
||||
//line->AddVertex(nextFEdge->vertexA()->point3D());
|
||||
// line->AddVertex(nextFEdge->vertexA()->point3D());
|
||||
AddVertexToLine(line, nextFEdge->vertexA());
|
||||
currentEdge = nextFEdge;
|
||||
nextFEdge = nextFEdge->nextEdge();
|
||||
} while ((nextFEdge != NULL) && (nextFEdge != firstEdge));
|
||||
// Add the last vertex
|
||||
//line->AddVertex(currentEdge->vertexB()->point3D());
|
||||
// line->AddVertex(currentEdge->vertexB()->point3D());
|
||||
AddVertexToLine(line, currentEdge->vertexB());
|
||||
}
|
||||
|
||||
|
||||
@@ -78,7 +78,8 @@ static real cotan(WVertex *vo, WVertex *v1, WVertex *v2)
|
||||
udotv = u * v;
|
||||
denom = sqrt(u.squareNorm() * v.squareNorm() - udotv * udotv);
|
||||
|
||||
/* denom can be zero if u==v. Returning 0 is acceptable, based on the callers of this function below. */
|
||||
/* denom can be zero if u==v. Returning 0 is acceptable, based on the callers of this function
|
||||
* below. */
|
||||
if (denom == 0.0)
|
||||
return 0.0;
|
||||
return (udotv / denom);
|
||||
@@ -109,9 +110,9 @@ static real angle_from_cotan(WVertex *vo, WVertex *v1, WVertex *v2)
|
||||
* Computes the Discrete Mean Curvature Normal approximation at @v.
|
||||
* The mean curvature at @v is half the magnitude of the vector @Kh.
|
||||
*
|
||||
* Note: the normal computed is not unit length, and may point either into or out of the surface, depending on
|
||||
* the curvature at @v. It is the responsibility of the caller of the function to use the mean curvature normal
|
||||
* appropriately.
|
||||
* Note: the normal computed is not unit length, and may point either into or out of the surface,
|
||||
* depending on the curvature at @v. It is the responsibility of the caller of the function to use
|
||||
* the mean curvature normal appropriately.
|
||||
*
|
||||
* This approximation is from the paper:
|
||||
* Discrete Differential-Geometry Operators for Triangulated 2-Manifolds
|
||||
@@ -119,8 +120,8 @@ static real angle_from_cotan(WVertex *vo, WVertex *v1, WVertex *v2)
|
||||
* VisMath '02, Berlin (Germany)
|
||||
* http://www-grail.usc.edu/pubs.html
|
||||
*
|
||||
* Returns: %true if the operator could be evaluated, %false if the evaluation failed for some reason (@v is
|
||||
* boundary or is the endpoint of a non-manifold edge.)
|
||||
* Returns: %true if the operator could be evaluated, %false if the evaluation failed for some
|
||||
* reason (@v is boundary or is the endpoint of a non-manifold edge.)
|
||||
*/
|
||||
bool gts_vertex_mean_curvature_normal(WVertex *v, Vec3r &Kh)
|
||||
{
|
||||
@@ -181,8 +182,8 @@ bool gts_vertex_mean_curvature_normal(WVertex *v, Vec3r &Kh)
|
||||
* VisMath '02, Berlin (Germany)
|
||||
* http://www-grail.usc.edu/pubs.html
|
||||
*
|
||||
* Returns: %true if the operator could be evaluated, %false if the evaluation failed for some reason (@v is
|
||||
* boundary or is the endpoint of a non-manifold edge.)
|
||||
* Returns: %true if the operator could be evaluated, %false if the evaluation failed for some
|
||||
* reason (@v is boundary or is the endpoint of a non-manifold edge.)
|
||||
*/
|
||||
bool gts_vertex_gaussian_curvature(WVertex *v, real *Kg)
|
||||
{
|
||||
@@ -223,7 +224,8 @@ bool gts_vertex_gaussian_curvature(WVertex *v, real *Kg)
|
||||
* @K1: first principal curvature.
|
||||
* @K2: second principal curvature.
|
||||
*
|
||||
* Computes the principal curvatures at a point given the mean and Gaussian curvatures at that point.
|
||||
* Computes the principal curvatures at a point given the mean and Gaussian curvatures at that
|
||||
* point.
|
||||
*
|
||||
* The mean curvature can be computed as one-half the magnitude of the vector computed by
|
||||
* gts_vertex_mean_curvature_normal().
|
||||
@@ -275,12 +277,12 @@ static void eigenvector(real a, real b, real c, Vec3r e)
|
||||
* @e1: first principal curvature direction (direction of largest curvature).
|
||||
* @e2: second principal curvature direction.
|
||||
*
|
||||
* Computes the principal curvature directions at a point given @Kh and @Kg, the mean curvature normal and
|
||||
* Gaussian curvatures at that point, computed with gts_vertex_mean_curvature_normal() and
|
||||
* gts_vertex_gaussian_curvature(), respectively.
|
||||
* Computes the principal curvature directions at a point given @Kh and @Kg, the mean curvature
|
||||
* normal and Gaussian curvatures at that point, computed with gts_vertex_mean_curvature_normal()
|
||||
* and gts_vertex_gaussian_curvature(), respectively.
|
||||
*
|
||||
* Note that this computation is very approximate and tends to be unstable. Smoothing of the surface or the principal
|
||||
* directions may be necessary to achieve reasonable results.
|
||||
* Note that this computation is very approximate and tends to be unstable. Smoothing of the
|
||||
* surface or the principal directions may be necessary to achieve reasonable results.
|
||||
*/
|
||||
void gts_vertex_principal_directions(WVertex *v, Vec3r Kh, real Kg, Vec3r &e1, Vec3r &e2)
|
||||
{
|
||||
@@ -306,8 +308,8 @@ void gts_vertex_principal_directions(WVertex *v, Vec3r Kh, real Kg, Vec3r &e1, V
|
||||
Kh.normalize();
|
||||
}
|
||||
else {
|
||||
/* This vertex is a point of zero mean curvature (flat or saddle point). Compute a normal by averaging
|
||||
* the adjacent triangles
|
||||
/* This vertex is a point of zero mean curvature (flat or saddle point). Compute a normal by
|
||||
* averaging the adjacent triangles
|
||||
*/
|
||||
N[0] = N[1] = N[2] = 0.0;
|
||||
|
||||
@@ -354,8 +356,9 @@ void gts_vertex_principal_directions(WVertex *v, Vec3r Kh, real Kg, Vec3r &e1, V
|
||||
continue;
|
||||
e = *itE;
|
||||
|
||||
/* since this vertex passed the tests in gts_vertex_mean_curvature_normal(), this should be true. */
|
||||
//g_assert(gts_edge_face_number (e, s) == 2);
|
||||
/* since this vertex passed the tests in gts_vertex_mean_curvature_normal(), this should be
|
||||
* true. */
|
||||
// g_assert(gts_edge_face_number (e, s) == 2);
|
||||
|
||||
/* identify the two triangles bordering e in s */
|
||||
f1 = e->GetaFace();
|
||||
@@ -365,17 +368,18 @@ void gts_vertex_principal_directions(WVertex *v, Vec3r Kh, real Kg, Vec3r &e1, V
|
||||
* B = [ a b ; b c ].
|
||||
* The computations here are from section 5 of [Meyer et al 2002].
|
||||
*
|
||||
* The first step is to calculate the linear equations governing the values of (a,b,c). These can be computed
|
||||
* by setting the derivatives of the error E to zero (section 5.3).
|
||||
* The first step is to calculate the linear equations governing the values of (a,b,c). These
|
||||
* can be computed by setting the derivatives of the error E to zero (section 5.3).
|
||||
*
|
||||
* Since a + c = norm(Kh), we only compute the linear equations for dE/da and dE/db. (NB: [Meyer et al 2002]
|
||||
* has the equation a + b = norm(Kh), but I'm almost positive this is incorrect).
|
||||
* Since a + c = norm(Kh), we only compute the linear equations for dE/da and dE/db. (NB:
|
||||
* [Meyer et al 2002] has the equation a + b = norm(Kh), but I'm almost positive this is
|
||||
* incorrect).
|
||||
*
|
||||
* Note that the w_ij (defined in section 5.2) are all scaled by (1/8*A_mixed). We drop this uniform scale
|
||||
* factor because the solution of the linear equations doesn't rely on it.
|
||||
* Note that the w_ij (defined in section 5.2) are all scaled by (1/8*A_mixed). We drop this
|
||||
* uniform scale factor because the solution of the linear equations doesn't rely on it.
|
||||
*
|
||||
* The terms of the linear equations are xterm_dy with x in {a,b,c} and y in {a,b}. There are also const_dy
|
||||
* terms that are the constant factors in the equations.
|
||||
* The terms of the linear equations are xterm_dy with x in {a,b,c} and y in {a,b}. There are
|
||||
* also const_dy terms that are the constant factors in the equations.
|
||||
*/
|
||||
|
||||
/* find the vector from v along edge e */
|
||||
@@ -389,8 +393,9 @@ void gts_vertex_principal_directions(WVertex *v, Vec3r Kh, real Kg, Vec3r &e1, V
|
||||
|
||||
/* section 5.2 */
|
||||
|
||||
/* I don't like performing a minimization where some of the weights can be negative (as can be the case
|
||||
* if f1 or f2 are obtuse). To ensure all-positive weights, we check for obtuseness. */
|
||||
/* I don't like performing a minimization where some of the weights can be negative (as can be
|
||||
* the case if f1 or f2 are obtuse). To ensure all-positive weights, we check for obtuseness.
|
||||
*/
|
||||
weight = 0.0;
|
||||
if (!triangle_obtuse(v, f1)) {
|
||||
weight += ve2 *
|
||||
@@ -471,12 +476,14 @@ void gts_vertex_principal_directions(WVertex *v, Vec3r Kh, real Kg, Vec3r &e1, V
|
||||
eig[1] = 0.0;
|
||||
}
|
||||
|
||||
/* Although the eigenvectors of B are good estimates of the principal directions, it seems that which one is
|
||||
* attached to which curvature direction is a bit arbitrary. This may be a bug in my implementation, or just
|
||||
* a side-effect of the inaccuracy of B due to the discrete nature of the sampling.
|
||||
/* Although the eigenvectors of B are good estimates of the principal directions, it seems that
|
||||
* which one is attached to which curvature direction is a bit arbitrary. This may be a bug in my
|
||||
* implementation, or just a side-effect of the inaccuracy of B due to the discrete nature of the
|
||||
* sampling.
|
||||
*
|
||||
* To overcome this behavior, we'll evaluate which assignment best matches the given eigenvectors by comparing
|
||||
* the curvature estimates computed above and the curvatures calculated from the discrete differential operators.
|
||||
* To overcome this behavior, we'll evaluate which assignment best matches the given eigenvectors
|
||||
* by comparing the curvature estimates computed above and the curvatures calculated from the
|
||||
* discrete differential operators.
|
||||
*/
|
||||
|
||||
gts_vertex_principal_curvatures(0.5 * normKh, Kg, &K1, &K2);
|
||||
|
||||
@@ -293,7 +293,7 @@ WOEdge *WFace::MakeEdge(WVertex *v1, WVertex *v2)
|
||||
// Adds the edge to the face
|
||||
AddEdge(woea);
|
||||
(*it1)->setNumberOfOEdges((*it1)->GetNumberOfOEdges() + 1);
|
||||
//sets these vertices as border:
|
||||
// sets these vertices as border:
|
||||
v1->setBorder(true);
|
||||
v2->setBorder(true);
|
||||
return woea;
|
||||
@@ -307,7 +307,7 @@ WOEdge *WFace::MakeEdge(WVertex *v1, WVertex *v2)
|
||||
// Adds the edge to the face
|
||||
AddEdge(woeb);
|
||||
(*it1)->setNumberOfOEdges((*it1)->GetNumberOfOEdges() + 1);
|
||||
//sets these vertices as border:
|
||||
// sets these vertices as border:
|
||||
v1->setBorder(true);
|
||||
v2->setBorder(true);
|
||||
return woeb;
|
||||
@@ -334,7 +334,7 @@ WOEdge *WFace::MakeEdge(WVertex *v1, WVertex *v2)
|
||||
}
|
||||
}
|
||||
|
||||
//DEBUG:
|
||||
// DEBUG:
|
||||
if (true == exist) { // The invert edge already exists
|
||||
// Retrieves the corresponding edge
|
||||
edge = pInvertEdge->GetOwner();
|
||||
@@ -347,7 +347,7 @@ WOEdge *WFace::MakeEdge(WVertex *v1, WVertex *v2)
|
||||
}
|
||||
else { // The invert edge does not exist yet
|
||||
// we must create a new edge
|
||||
//edge = new WEdge;
|
||||
// edge = new WEdge;
|
||||
edge = instanciateEdge();
|
||||
|
||||
// updates the a,b vertex edges list:
|
||||
@@ -365,7 +365,7 @@ WOEdge *WFace::MakeEdge(WVertex *v1, WVertex *v2)
|
||||
cerr << "Warning: edge " << this << " null with vertex " << v1->GetId() << endl;
|
||||
|
||||
edge->AddOEdge(pOEdge);
|
||||
//edge->setNumberOfOEdges(edge->GetNumberOfOEdges() + 1);
|
||||
// edge->setNumberOfOEdges(edge->GetNumberOfOEdges() + 1);
|
||||
|
||||
// Add this face (the b face)
|
||||
pOEdge->setbFace(this);
|
||||
@@ -468,7 +468,7 @@ WShape::WShape(WShape &iBrother)
|
||||
vector<WVertex *> &vertexList = iBrother.getVertexList();
|
||||
vector<WVertex *>::iterator v = vertexList.begin(), vend = vertexList.end();
|
||||
for (; v != vend; ++v) {
|
||||
//WVertex *newVertex = new WVertex(*(*v));
|
||||
// WVertex *newVertex = new WVertex(*(*v));
|
||||
WVertex *newVertex = (*v)->duplicate();
|
||||
|
||||
newVertex->setShape(this);
|
||||
@@ -478,7 +478,7 @@ WShape::WShape(WShape &iBrother)
|
||||
vector<WEdge *> &edgeList = iBrother.getEdgeList();
|
||||
vector<WEdge *>::iterator e = edgeList.begin(), eend = edgeList.end();
|
||||
for (; e != eend; ++e) {
|
||||
//WEdge *newEdge = new WEdge(*(*e));
|
||||
// WEdge *newEdge = new WEdge(*(*e));
|
||||
WEdge *newEdge = (*e)->duplicate();
|
||||
AddEdge(newEdge);
|
||||
}
|
||||
@@ -486,7 +486,7 @@ WShape::WShape(WShape &iBrother)
|
||||
vector<WFace *> &faceList = iBrother.GetFaceList();
|
||||
vector<WFace *>::iterator f = faceList.begin(), fend = faceList.end();
|
||||
for (; f != fend; ++f) {
|
||||
//WFace *newFace = new WFace(*(*f));
|
||||
// WFace *newFace = new WFace(*(*f));
|
||||
WFace *newFace = (*f)->duplicate();
|
||||
AddFace(newFace);
|
||||
}
|
||||
@@ -539,8 +539,8 @@ WShape::WShape(WShape &iBrother)
|
||||
WOEdge *current = oedgeList[i];
|
||||
oedgedata *currentoedata = (oedgedata *)current->userdata;
|
||||
newoedgelist.push_back(currentoedata->_copy);
|
||||
//oedgeList[i] = currentoedata->_copy;
|
||||
//oedgeList[i] = ((oedgedata *)(oedgeList[i]->userdata))->_copy;
|
||||
// oedgeList[i] = currentoedata->_copy;
|
||||
// oedgeList[i] = ((oedgedata *)(oedgeList[i]->userdata))->_copy;
|
||||
}
|
||||
(*f)->setEdgeList(newoedgelist);
|
||||
}
|
||||
@@ -662,11 +662,11 @@ WFace *WShape::MakeFace(vector<WVertex *> &iVertexList,
|
||||
for (; va != iVertexList.end(); va = vb) {
|
||||
++vb;
|
||||
// Adds va to the vertex list:
|
||||
//face->AddVertex(*va);
|
||||
// face->AddVertex(*va);
|
||||
|
||||
WOEdge *oedge;
|
||||
if (*va == iVertexList.back())
|
||||
oedge = face->MakeEdge(*va, iVertexList.front()); //for the last (closing) edge
|
||||
oedge = face->MakeEdge(*va, iVertexList.front()); // for the last (closing) edge
|
||||
else
|
||||
oedge = face->MakeEdge(*va, *vb);
|
||||
|
||||
|
||||
@@ -178,7 +178,7 @@ class WVertex {
|
||||
{
|
||||
}
|
||||
#endif
|
||||
virtual ~incoming_edge_iterator(){}; //soc
|
||||
virtual ~incoming_edge_iterator(){}; // soc
|
||||
|
||||
protected:
|
||||
friend class WVertex;
|
||||
@@ -237,7 +237,7 @@ class WVertex {
|
||||
|
||||
// dereferencing
|
||||
virtual WOEdge *operator*();
|
||||
//virtual WOEdge **operator->();
|
||||
// virtual WOEdge **operator->();
|
||||
protected:
|
||||
virtual void increment();
|
||||
|
||||
@@ -266,7 +266,7 @@ class WVertex {
|
||||
{
|
||||
}
|
||||
#endif
|
||||
virtual ~face_iterator(){}; //soc
|
||||
virtual ~face_iterator(){}; // soc
|
||||
|
||||
protected:
|
||||
friend class WVertex;
|
||||
@@ -321,7 +321,7 @@ class WVertex {
|
||||
|
||||
// dereferencing
|
||||
virtual WFace *operator*();
|
||||
//virtual WOEdge **operator->();
|
||||
// virtual WOEdge **operator->();
|
||||
|
||||
protected:
|
||||
inline void increment()
|
||||
@@ -401,7 +401,7 @@ class WOEdge {
|
||||
userdata = NULL;
|
||||
}
|
||||
|
||||
virtual ~WOEdge(){}; //soc
|
||||
virtual ~WOEdge(){}; // soc
|
||||
|
||||
/*! copy constructor */
|
||||
WOEdge(WOEdge &iBrother);
|
||||
@@ -1196,10 +1196,9 @@ class WShape {
|
||||
/*! adds a new face to the shape
|
||||
* returns the built face.
|
||||
* iVertexList
|
||||
* List of face's vertices. These vertices are not added to the WShape vertex list; they are supposed to be
|
||||
* already stored when calling MakeFace.
|
||||
* The order in which the vertices are stored in the list determines the face's edges orientation and (so) the
|
||||
* face orientation.
|
||||
* List of face's vertices. These vertices are not added to the WShape vertex list; they are
|
||||
* supposed to be already stored when calling MakeFace. The order in which the vertices are
|
||||
* stored in the list determines the face's edges orientation and (so) the face orientation.
|
||||
* iMaterialIndex
|
||||
* The material index for this face
|
||||
*/
|
||||
@@ -1207,21 +1206,16 @@ class WShape {
|
||||
vector<bool> &iFaceEdgeMarksList,
|
||||
unsigned iMaterialIndex);
|
||||
|
||||
/*! adds a new face to the shape. The difference with the previous method is that this one is designed
|
||||
* to build a WingedEdge structure for which there are per vertex normals, opposed to per face normals.
|
||||
* returns the built face.
|
||||
* iVertexList
|
||||
* List of face's vertices. These vertices are not added to the WShape vertex list; they are supposed to be
|
||||
* already stored when calling MakeFace.
|
||||
* The order in which the vertices are stored in the list determines the face's edges orientation and (so) the
|
||||
* face orientation.
|
||||
* iMaterialIndex
|
||||
* The materialIndex for this face
|
||||
/*! adds a new face to the shape. The difference with the previous method is that this one is
|
||||
* designed to build a WingedEdge structure for which there are per vertex normals, opposed to
|
||||
* per face normals. returns the built face. iVertexList List of face's vertices. These vertices
|
||||
* are not added to the WShape vertex list; they are supposed to be already stored when calling
|
||||
* MakeFace. The order in which the vertices are stored in the list determines the face's edges
|
||||
* orientation and (so) the face orientation. iMaterialIndex The materialIndex for this face
|
||||
* iNormalsList
|
||||
* The list of normals, iNormalsList[i] corresponding to the normal of the vertex iVertexList[i] for that face.
|
||||
* iTexCoordsList
|
||||
* The list of tex coords, iTexCoordsList[i] corresponding to the normal of the vertex iVertexList[i] for
|
||||
* that face.
|
||||
* The list of normals, iNormalsList[i] corresponding to the normal of the vertex
|
||||
* iVertexList[i] for that face. iTexCoordsList The list of tex coords, iTexCoordsList[i]
|
||||
* corresponding to the normal of the vertex iVertexList[i] for that face.
|
||||
*/
|
||||
virtual WFace *MakeFace(vector<WVertex *> &iVertexList,
|
||||
vector<Vec3f> &iNormalsList,
|
||||
@@ -1300,16 +1294,17 @@ class WShape {
|
||||
#endif
|
||||
|
||||
protected:
|
||||
/*! Builds the face passed as argument (which as already been allocated)
|
||||
* iVertexList
|
||||
* List of face's vertices. These vertices are not added to the WShape vertex list; they are supposed to be
|
||||
* already stored when calling MakeFace.
|
||||
* The order in which the vertices are stored in the list determines the face's edges orientation and (so) the
|
||||
* face orientation.
|
||||
* iMaterialIndex
|
||||
* The material index for this face
|
||||
* face
|
||||
* The Face that is filled in
|
||||
/*!
|
||||
* Builds the face passed as argument (which as already been allocated)
|
||||
* - iVertexList
|
||||
* List of face's vertices. These vertices are not added to the WShape vertex list;
|
||||
* they are supposed to be already stored when calling MakeFace.
|
||||
* The order in which the vertices are stored in the list determines
|
||||
* the face's edges orientation and (so) the face orientation.
|
||||
* - iMaterialIndex
|
||||
* The material index for this face
|
||||
* - face
|
||||
* The Face that is filled in
|
||||
*/
|
||||
virtual WFace *MakeFace(vector<WVertex *> &iVertexList,
|
||||
vector<bool> &iFaceEdgeMarksList,
|
||||
|
||||
@@ -91,8 +91,9 @@ WXSmoothEdge *WXFaceLayer::BuildSmoothEdge()
|
||||
return 0;
|
||||
|
||||
// let us determine which cusp edge corresponds to the starting:
|
||||
// We can do that because we defined that a silhouette edge had the back facing part on its right.
|
||||
// So if the WOEdge woea is such that woea[0].dotp > 0 and woea[1].dotp < 0, it is the starting edge.
|
||||
// We can do that because we defined that a silhouette edge had the back facing part on its
|
||||
// right. So if the WOEdge woea is such that woea[0].dotp > 0 and woea[1].dotp < 0, it is the
|
||||
// starting edge.
|
||||
//-------------------------------------------
|
||||
|
||||
if (_DotP[cuspEdgesIndices[0]] > 0.0f) {
|
||||
@@ -114,7 +115,8 @@ WXSmoothEdge *WXFaceLayer::BuildSmoothEdge()
|
||||
ok = true;
|
||||
}
|
||||
else if (_nNullDotP == 1) {
|
||||
// that means that we have exactly one of the 2 extremities of our silhouette edge is a vertex of the mesh
|
||||
// that means that we have exactly one of the 2 extremities of our silhouette edge is a vertex
|
||||
// of the mesh
|
||||
if ((_nPosDotP == 2) || (_nPosDotP == 0)) {
|
||||
_pSmoothEdge = NULL;
|
||||
return _pSmoothEdge;
|
||||
@@ -193,7 +195,8 @@ WXSmoothEdge *WXFaceLayer::BuildSmoothEdge()
|
||||
if ((front()) ^
|
||||
(bface->front())) { // fA->front XOR fB->front (true if one is 0 and the other is 1)
|
||||
// that means that the edge i of the face is a silhouette edge
|
||||
// CHECK FIRST WHETHER THE EXACTSILHOUETTEEDGE HAS NOT YET BEEN BUILT ON THE OTHER FACE (1 is enough).
|
||||
// CHECK FIRST WHETHER THE EXACTSILHOUETTEEDGE HAS
|
||||
// NOT YET BEEN BUILT ON THE OTHER FACE (1 is enough).
|
||||
if (((WSExactFace *)bface)->exactSilhouetteEdge()) {
|
||||
// that means that this silhouette edge has already been built
|
||||
return ((WSExactFace *)bface)->exactSilhouetteEdge();
|
||||
|
||||
@@ -108,8 +108,8 @@ class WXEdge : public WEdge {
|
||||
WXNature _nature;
|
||||
// 0: the order doesn't matter. 1: the order is the orginal one. -1: the order is not good
|
||||
short _order;
|
||||
// A front facing edge is an edge for which the bording face which is the nearest from the viewpoint is front.
|
||||
// A back facing edge is the opposite.
|
||||
// A front facing edge is an edge for which the bording face which is the nearest from the
|
||||
// viewpoint is front. A back facing edge is the opposite.
|
||||
bool _front;
|
||||
|
||||
public:
|
||||
@@ -322,13 +322,13 @@ class WXFaceLayer {
|
||||
public:
|
||||
void *userdata;
|
||||
WXFace *_pWXFace;
|
||||
// in case of silhouette: the values obtained when computing the normal-view direction dot product. _DotP[i] is
|
||||
// this value for the vertex i for that face.
|
||||
// in case of silhouette: the values obtained when computing the normal-view direction dot
|
||||
// product. _DotP[i] is this value for the vertex i for that face.
|
||||
vector<float> _DotP;
|
||||
WXSmoothEdge *_pSmoothEdge;
|
||||
WXNature _Nature;
|
||||
|
||||
//oldtmp values
|
||||
// oldtmp values
|
||||
// count the number of positive dot products for vertices.
|
||||
// if this number is != 0 and !=_DotP.size() -> it is a silhouette fac
|
||||
unsigned _nPosDotP;
|
||||
@@ -435,14 +435,16 @@ class WXFaceLayer {
|
||||
}
|
||||
}
|
||||
|
||||
/*! If one of the face layer vertex has a DotP equal to 0, this method returns the vertex where it happens */
|
||||
/*! If one of the face layer vertex has a DotP equal to 0, this method returns the vertex where
|
||||
* it happens */
|
||||
unsigned int Get0VertexIndex() const;
|
||||
|
||||
/*! In case one of the edge of the triangle is a smooth edge, this method allows to retrieve the concerned edge */
|
||||
/*! In case one of the edge of the triangle is a smooth edge, this method allows to retrieve the
|
||||
* concerned edge */
|
||||
unsigned int GetSmoothEdgeIndex() const;
|
||||
|
||||
/*! retrieves the edges of the triangle for which the signs are different (a null value is not considered) for
|
||||
* the dotp values at each edge extrimity
|
||||
/*! retrieves the edges of the triangle for which the signs are different (a null value is not
|
||||
* considered) for the dotp values at each edge extrimity
|
||||
*/
|
||||
void RetrieveCuspEdgesIndices(vector<int> &oCuspEdges);
|
||||
|
||||
@@ -492,8 +494,8 @@ class WXFace : public WFace {
|
||||
bool _front; // flag to tell whether the face is front facing or back facing
|
||||
float _dotp; // value obtained when computing the normal-viewpoint dot product
|
||||
|
||||
vector<WXFaceLayer *>
|
||||
_SmoothLayers; // The data needed to store one or several smooth edges that traverse the face
|
||||
vector<WXFaceLayer *> _SmoothLayers; // The data needed to store one or several smooth edges
|
||||
// that traverse the face
|
||||
|
||||
public:
|
||||
inline WXFace() : WFace()
|
||||
@@ -701,8 +703,8 @@ class WXShape : public WShape {
|
||||
#endif
|
||||
|
||||
protected:
|
||||
bool
|
||||
_computeViewIndependent; // flag to indicate whether the view independent stuff must be computed or not
|
||||
bool _computeViewIndependent; // flag to indicate whether the view independent stuff must be
|
||||
// computed or not
|
||||
|
||||
public:
|
||||
inline WXShape() : WShape()
|
||||
@@ -742,29 +744,35 @@ class WXShape : public WShape {
|
||||
return new WXFace;
|
||||
}
|
||||
|
||||
/*! adds a new face to the shape returns the built face.
|
||||
* iVertexList
|
||||
* List of face's vertices. These vertices are not added to the WShape vertex list; they are supposed
|
||||
* to be already stored when calling MakeFace. The order in which the vertices are stored in the list
|
||||
* determines the face's edges orientation and (so) the face orientation.
|
||||
/*!
|
||||
* Adds a new face to the shape returns the built face.
|
||||
* - iVertexList
|
||||
* List of face's vertices.
|
||||
* These vertices are not added to the WShape vertex list; they are
|
||||
* supposed to be already stored when calling MakeFace. The order in which the vertices are
|
||||
* stored in the list determines the face's edges orientation and (so) the face orientation.
|
||||
*/
|
||||
virtual WFace *MakeFace(vector<WVertex *> &iVertexList,
|
||||
vector<bool> &iFaceEdgeMarksList,
|
||||
unsigned iMaterialIndex);
|
||||
|
||||
/*! adds a new face to the shape. The difference with the previous method is that this one is designed to build
|
||||
* a WingedEdge structure for which there are per vertex normals, opposed to per face normals.
|
||||
* returns the built face.
|
||||
* iVertexList
|
||||
* List of face's vertices. These vertices are not added to the WShape vertex list; they are supposed to be
|
||||
* already stored when calling MakeFace.
|
||||
* The order in which the vertices are stored in the list determines the face's edges orientation and (so) the
|
||||
* face orientation.
|
||||
* iNormalsList
|
||||
* The list of normals, iNormalsList[i] corresponding to the normal of the vertex iVertexList[i] for that face.
|
||||
* iTexCoordsList
|
||||
* The list of tex coords, iTexCoordsList[i] corresponding to the normal of the vertex iVertexList[i] for
|
||||
* that face.
|
||||
/*!
|
||||
* Adds a new face to the shape.
|
||||
* The difference with the previous method is that this one is designed to build a WingedEdge
|
||||
* structure for which there are per vertex normals, opposed to per face normals.
|
||||
* returns the built face.
|
||||
*
|
||||
* - iVertexList:
|
||||
* List of face's vertices. These vertices are not added to the WShape vertex list;
|
||||
* they are supposed to be already stored when calling MakeFace.
|
||||
* The order in which the vertices are stored in the list determines
|
||||
* the face's edges orientation and (so) the face orientation.
|
||||
* - iNormalsList:
|
||||
* The list of normals, iNormalsList[i]
|
||||
* corresponding to the normal of the vertex iVertexList[i] for that face.
|
||||
* - iTexCoordsList:
|
||||
* The list of tex coords, iTexCoordsList[i]
|
||||
* corresponding to the normal of the vertex iVertexList[i] for that face.
|
||||
*/
|
||||
virtual WFace *MakeFace(vector<WVertex *> &iVertexList,
|
||||
vector<Vec3f> &iNormalsList,
|
||||
@@ -781,7 +789,7 @@ class WXShape : public WShape {
|
||||
((WXEdge *)(*we))->Reset();
|
||||
}
|
||||
|
||||
//Reset faces:
|
||||
// Reset faces:
|
||||
vector<WFace *> &wfaces = GetFaceList();
|
||||
for (vector<WFace *>::iterator wf = wfaces.begin(), wfend = wfaces.end(); wf != wfend; ++wf) {
|
||||
((WXFace *)(*wf))->Reset();
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
|
||||
/** \file
|
||||
* \ingroup freestyle
|
||||
* \brief Class inherited from WingedEdgeBuilder and designed to build a WX (WingedEdge + extended info
|
||||
* (silhouette etc...)) structure from a polygonal model
|
||||
* \brief Class inherited from WingedEdgeBuilder and designed to build a WX (WingedEdge + extended
|
||||
* info (silhouette etc...)) structure from a polygonal model
|
||||
*/
|
||||
|
||||
#include "WXEdge.h"
|
||||
@@ -37,7 +37,7 @@ void WXEdgeBuilder::visitIndexedFaceSet(IndexedFaceSet &ifs)
|
||||
shape->setId(ifs.getId().getFirst());
|
||||
shape->setName(ifs.getName());
|
||||
shape->setLibraryPath(ifs.getLibraryPath());
|
||||
//ifs.setId(shape->GetId());
|
||||
// ifs.setId(shape->GetId());
|
||||
}
|
||||
|
||||
void WXEdgeBuilder::buildWVertices(WShape &shape, const float *vertices, unsigned vsize)
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
/** \file
|
||||
* \ingroup freestyle
|
||||
* \brief Class inherited from WingedEdgeBuilder and designed to build a WX (WingedEdge + extended info
|
||||
* (silhouette etc...)) structure from a polygonal model
|
||||
* \brief Class inherited from WingedEdgeBuilder and designed to build a WX (WingedEdge + extended
|
||||
* info (silhouette etc...)) structure from a polygonal model
|
||||
*/
|
||||
|
||||
#include "WingedEdgeBuilder.h"
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
|
||||
/** \file
|
||||
* \ingroup freestyle
|
||||
* \brief Class to render a WingedEdge data structure from a polyhedral data structure organized in nodes
|
||||
* of a scene graph
|
||||
* \brief Class to render a WingedEdge data structure from a polyhedral data structure organized in
|
||||
* nodes of a scene graph
|
||||
*/
|
||||
|
||||
#include <set>
|
||||
@@ -42,12 +42,12 @@ void WingedEdgeBuilder::visitIndexedFaceSet(IndexedFaceSet &ifs)
|
||||
return;
|
||||
}
|
||||
shape->setId(ifs.getId().getFirst());
|
||||
//ifs.setId(shape->GetId());
|
||||
// ifs.setId(shape->GetId());
|
||||
}
|
||||
|
||||
void WingedEdgeBuilder::visitNodeShape(NodeShape &ns)
|
||||
{
|
||||
//Sets the current material to iShapeode->material:
|
||||
// Sets the current material to iShapeode->material:
|
||||
_current_frs_material = &(ns.frs_material());
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ bool WingedEdgeBuilder::buildWShape(WShape &shape, IndexedFaceSet &ifs)
|
||||
{
|
||||
unsigned int vsize = ifs.vsize();
|
||||
unsigned int nsize = ifs.nsize();
|
||||
//soc unused - unsigned tsize = ifs.tsize();
|
||||
// soc unused - unsigned tsize = ifs.tsize();
|
||||
|
||||
const float *vertices = ifs.vertices();
|
||||
const float *normals = ifs.normals();
|
||||
@@ -256,7 +256,7 @@ void WingedEdgeBuilder::buildTriangleStrip(const float * /*vertices*/,
|
||||
{
|
||||
unsigned nDoneVertices = 2; // number of vertices already treated
|
||||
unsigned nTriangle = 0; // number of the triangle currently being treated
|
||||
//int nVertex = 0; // vertex number
|
||||
// int nVertex = 0; // vertex number
|
||||
|
||||
WShape *currentShape = _current_wshape; // the current shape being built
|
||||
vector<WVertex *> triangleVertices;
|
||||
@@ -265,9 +265,9 @@ void WingedEdgeBuilder::buildTriangleStrip(const float * /*vertices*/,
|
||||
vector<bool> triangleFaceEdgeMarks;
|
||||
|
||||
while (nDoneVertices < nvertices) {
|
||||
//clear the vertices list:
|
||||
// clear the vertices list:
|
||||
triangleVertices.clear();
|
||||
//Then rebuild it:
|
||||
// Then rebuild it:
|
||||
if (0 == nTriangle % 2) { // if nTriangle is even
|
||||
triangleVertices.push_back(currentShape->getVertexList()[vindices[nTriangle] / 3]);
|
||||
triangleVertices.push_back(currentShape->getVertexList()[vindices[nTriangle + 1] / 3]);
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
/** \file
|
||||
* \ingroup freestyle
|
||||
* \brief Class to render a WingedEdge data structure from a polyhedral data structure organized in nodes
|
||||
* of a scene graph
|
||||
* \brief Class to render a WingedEdge data structure
|
||||
* from a polyhedral data structure organized in nodes of a scene graph.
|
||||
*/
|
||||
|
||||
#include "WEdge.h"
|
||||
|
||||
Reference in New Issue
Block a user