_pViewer = iViewer;
}
-int AppCanvas::width() const
+int AppCanvas::width() const
{
return _pViewer->width();
}
return _pViewer->thickness();
}
-BBox<Vec3r> AppCanvas::scene3DBBox() const
+BBox<Vec3r> AppCanvas::scene3DBBox() const
{
return _pViewer->scene3DBBox();
}
// retrieve the 3D viewpoint and transformations information
//----------------------------------------------------------
- // Save the viewpoint context at the view level in order
+ // Save the viewpoint context at the view level in order
// to be able to restore it later:
// Restore the context of view:
- // we need to perform all these operations while the
+ // we need to perform all these operations while the
// 3D context is on.
Vec3f vp(UNPACK3(g_freestyle.viewpoint));
}
}
- // We might have several times the same vertex. We want a clean
+ // We might have several times the same vertex. We want a clean
// shape with no real-vertex. Here, we are making a cleaning pass.
float *cleanVertices = NULL;
unsigned int cvSize;
freestyle_scene->r.gauss = old_scene->r.gauss;
freestyle_scene->r.dither_intensity = old_scene->r.dither_intensity;
BLI_strncpy(freestyle_scene->r.engine, old_scene->r.engine, sizeof(freestyle_scene->r.engine));
- freestyle_scene->r.im_format.planes = R_IMF_PLANES_RGBA;
+ freestyle_scene->r.im_format.planes = R_IMF_PLANES_RGBA;
freestyle_scene->r.im_format.imtype = R_IMF_IMTYPE_PNG;
if (G.debug & G_DEBUG_FREESTYLE) {
};
//=======================================================
-// Initialization
+// Initialization
//=======================================================
void FRS_initialize()
}
//=======================================================
-// Rendering
+// Rendering
//=======================================================
static void init_view(Render *re)
namespace Freestyle {
-/*! Class to define a regular grid used for ray casting computations
+/*! 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)
*/
}
/* returns length of input vector */
-static double V2Length(Vector2 *a)
+static double V2Length(Vector2 *a)
{
return (sqrt(V2SquaredLength(a)));
}
(*c)[0] = (*a)[0] + (*b)[0];
(*c)[1] = (*a)[1] + (*b)[1];
return c;
-}
+}
/* normalizes the input vector and returns it */
static Vector2 *V2Normalize(Vector2 *v)
* Control points of the sets of bezier curve segments.
* Each segment is made of 4 points (polynomial degree of curve = 3)
* error
- * max error tolerance between resulting curve and input data
+ * max error tolerance between resulting curve and input data
*/
void FitCurve(std::vector<Vec2d>& data, std::vector<Vec2d>& oCurve, double error);
*/
void fromWorldToImage(const Vec3r& p, Vec3r& q, const real transform[4][4], const int viewport[4]);
-/*! Projects from world coordinates to camera coordinates
+/*! Projects from world coordinates to camera coordinates
* Returns the point's coordinates expressed in the camera's
* coordinates system.
* p
*/
void fromImageToRetina(const Vec3r& p, Vec3r& q, const int viewport[4]);
-/*! computes the coordinates of q in the camera coordinates system,
+/*! computes the coordinates of q in the camera coordinates system,
* using the known z coordinates of the 3D point.
* That means that this method does not inverse any matrices,
* it only computes X and Y from x,y and Z)
real t_min, t;
unsigned i;
- t_min = FLT_MAX; // init tmin with handle of the case where one or 2 _u[i] = 0.
+ 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)
distance = PPb.norm();
return Pb; // closest point lies on AB
-}
+}
inline Vec3r closestPointOnPolygon(const Vec3r& point, const Polygon3r& poly)
{
template<class T, class Point>
-class SweepLine
+class SweepLine
{
public:
SweepLine() {}
}
}
- inline void process(Point& p, vector<Segment<T, Point>*>& segments,
+ inline void process(Point& p, vector<Segment<T, Point>*>& segments,
#if 0
binary_rule<Segment<T, Point>,Segment<T, Point> >& binrule = \
binary_rule<Segment<T, Point>, Segment<T, Point> >(),
Vec<T, N> res(v);
res += *this;
return res;
- }
+ }
inline Vec<T, N> operator-(const Vec<T, N>& v) const
{
Vec<T, N> res(*this);
res -= v;
return res;
- }
+ }
inline Vec<T, N> operator*(const typename Vec<T, N>::value_type r) const
{
Vec<T, N> res(*this);
res *= r;
return res;
- }
+ }
inline Vec<T, N> operator/(const typename Vec<T, N>::value_type r) const
{
if (r)
res /= r;
return res;
- }
+ }
// dot product
inline value_type operator*(const Vec<T, N>& v) const
for (unsigned int i = 0; i < N; i++)
sum += (*this)[i] * v[i];
return sum;
- }
+ }
template <class U>
inline Vec<T, N>& operator=(const Vec<U, N>& v)
if (this->_coord[i] == v[i])
continue;
}
- return false;
+ return false;
}
inline bool operator>(const Vec<T, N>& v) const
if (this->_coord[i] == v[i])
continue;
}
- return false;
+ return false;
}
protected:
// Ugly Fortran-porting trick: indices for v are between 1 and n
v--;
- // Step 3 : compute the weight of the non diagonal terms
+ // Step 3 : compute the weight of the non diagonal terms
ij = 1;
a_norm = 0.0;
for (i = 1; i <= n; i++) {
index[i] = jj;
}
- // Step 7: save the eigen vectors
+ // Step 7: save the eigen vectors
// back from Fortran to to C++
v++;
};
/*
-
+
#############################################
#############################################
#############################################
#############################################
#############################################
#############################################
-
+
*/
template<class Map>
float vec_data[3]; // because vec->_coord is protected
vec_data[0] = vec.x();
vec_data[1] = vec.y();
- vec_data[2] = vec.z();
+ vec_data[2] = vec.z();
return Vector_CreatePyObject(vec_data, 3, NULL);
}
PyObject *py_ss = SShape_Type.tp_new(&SShape_Type, 0, 0);
((BPy_SShape *)py_ss)->ss = &ss;
((BPy_SShape *)py_ss)->borrowed = true;
- return py_ss;
+ return py_ss;
}
PyObject *BPy_ViewShape_from_ViewShape(ViewShape& vs)
#include "../geometry/BBox.h"
// FEdge, FEdgeSharp, FEdgeSmooth, SShape, SVertex, FEdgeInternal::SVertexIterator
-#include "../view_map/Silhouette.h"
+#include "../view_map/Silhouette.h"
// Id
#include "../system/Id.h"
PyObject *Freestyle_Init(void)
{
PyObject *module;
-
+
// initialize modules
module = PyModule_Create(&module_definition);
if (!module)
else {
printf("Freestyle: couldn't find 'scripts/freestyle/modules', Freestyle won't work properly.\n");
}
-
+
// attach its classes (adding the object types to the module)
-
+
// those classes have to be initialized before the others
MediumType_Init(module);
Nature_Init(module);
int IntegrationType_Init(PyObject *module)
{
PyObject *m, *d, *f;
-
+
if (module == NULL)
return -1;
PyDict_SetItemString(IntegrationType_Type.tp_dict, "MAX", BPy_IntegrationType_MAX);
PyDict_SetItemString(IntegrationType_Type.tp_dict, "FIRST", BPy_IntegrationType_FIRST);
PyDict_SetItemString(IntegrationType_Type.tp_dict, "LAST", BPy_IntegrationType_LAST);
-
+
m = PyModule_Create(&module_definition);
if (m == NULL)
return -1;
if (PyType_Ready(&SVertex_Type) < 0)
return -1;
Py_INCREF(&SVertex_Type);
- PyModule_AddObject(module, "SVertex", (PyObject *)&SVertex_Type);
+ PyModule_AddObject(module, "SVertex", (PyObject *)&SVertex_Type);
if (PyType_Ready(&ViewVertex_Type) < 0)
return -1;
//-------------------MODULE INITIALIZATION--------------------------------
int MediumType_Init(PyObject *module)
-{
+{
if (module == NULL)
return -1;
vector< SVertex * >::iterator it;
PyObject *py_vertices = PyList_New(vertices.size());
unsigned int i = 0;
-
+
for (it = vertices.begin(); it != vertices.end(); it++) {
PyList_SET_ITEM(py_vertices, i++, BPy_SVertex_from_SVertex(*(*it)));
}
-
+
return py_vertices;
}
vector< FEdge * >::iterator it;
PyObject *py_edges = PyList_New(edges.size());
unsigned int i = 0;
-
+
for (it = edges.begin(); it != edges.end(); it++) {
PyList_SET_ITEM(py_edges, i++, Any_BPy_FEdge_from_FEdge(*(*it)));
}
-
+
return py_edges;
}
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Stroke_Type, &py_s))
return NULL;
-
+
if (typeid(*(self->ss)) == typeid(StrokeShader)) {
PyErr_SetString(PyExc_TypeError, "shade method not properly overridden");
return NULL;
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface1D_Type, &py_if1D))
return NULL;
-
+
Interface1D *if1D = ((BPy_Interface1D *)py_if1D)->if1D;
-
+
if (!if1D) {
string class_name(Py_TYPE(self)->tp_name);
PyErr_SetString(PyExc_RuntimeError, (class_name + " has no Interface1D").c_str());
{
PyObject *item;
vector< ViewVertex *> v;
-
+
if (!PyList_Check(value)) {
PyErr_SetString(PyExc_TypeError, "value must be a list of ViewVertex objects");
return -1;
//------------------------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` > :class:`ViewMapGradientNormBP1D`\n"
vec.push_back(b);
}
((UnaryFunction1D< vector<ViewShape*> > *)uf1D)->result = vec;
- }
+ }
Py_DECREF(result);
return 0;
}
// UnaryPredicate0D: __call__
int Director_BPy_UnaryPredicate0D___call__(UnaryPredicate0D *up0D, Interface0DIterator& if0D_it);
-
+
// UnaryPredicate1D: __call__
int Director_BPy_UnaryPredicate1D___call__(UnaryPredicate1D *up1D, Interface1D& if1D);
static PyObject *SVertex_normals_get(BPy_SVertex *self, void *UNUSED(closure))
{
- PyObject *py_normals;
+ PyObject *py_normals;
set< Vec3r > normals = self->sv->normals();
set< Vec3r >::iterator it;
py_normals = PyList_New(normals.size());
return PyLong_FromLong(self->s->strokeVerticesSize());
}
-static PyMethodDef BPy_Stroke_methods[] = {
+static PyMethodDef BPy_Stroke_methods[] = {
{"compute_sampling", (PyCFunction)Stroke_compute_sampling, METH_VARARGS | METH_KEYWORDS,
Stroke_compute_sampling_doc},
{"resample", (PyCFunction)Stroke_resample, METH_VARARGS | METH_KEYWORDS, Stroke_resample_doc},
":type: :class:`ViewShape`");
static PyObject *ViewEdge_viewshape_get(BPy_ViewEdge *self, void *UNUSED(closure))
-{
+{
ViewShape *vs = self->ve->viewShape();
if (vs)
return BPy_ViewShape_from_ViewShape(*vs);
bool restrict_to_selection = (!obj1) ? true : bool_from_PyBool(obj1);
ViewEdge *begin = (!obj2 || obj2 == Py_None) ? NULL : ((BPy_ViewEdge *)obj2)->ve;
bool orientation = (!obj3) ? true : bool_from_PyBool(obj3);
- self->cs_it = new ChainSilhouetteIterator(restrict_to_selection, begin, orientation);
+ self->cs_it = new ChainSilhouetteIterator(restrict_to_selection, begin, orientation);
}
else {
PyErr_SetString(PyExc_TypeError, "invalid argument(s)");
if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj))
return -1;
-
+
if (!obj)
self->uf1D_double = new UnaryFunction1D<double>();
else {
self->uf1D_double = new UnaryFunction1D<double>(IntegrationType_from_BPy_IntegrationType(obj));
}
-
+
self->uf1D_double->py_uf1D = (PyObject *)self;
-
+
return 0;
}
if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj))
return -1;
-
+
if (!obj)
self->uf1D_edgenature = new UnaryFunction1D<Nature::EdgeNature>();
else {
self->uf1D_edgenature = new UnaryFunction1D<Nature::EdgeNature>(IntegrationType_from_BPy_IntegrationType(obj));
}
-
+
self->uf1D_edgenature->py_uf1D = (PyObject *)self;
-
+
return 0;
}
if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj))
return -1;
-
+
if (!obj)
self->uf1D_float = new UnaryFunction1D<float>();
else {
self->uf1D_float = new UnaryFunction1D<float>(IntegrationType_from_BPy_IntegrationType(obj));
}
-
+
self->uf1D_float->py_uf1D = (PyObject *)self;
-
+
return 0;
}
if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj))
return -1;
-
+
if (!obj)
self->uf1D_unsigned = new UnaryFunction1D<unsigned int>();
else {
self->uf1D_unsigned = new UnaryFunction1D<unsigned int>(IntegrationType_from_BPy_IntegrationType(obj));
}
-
+
self->uf1D_unsigned->py_uf1D = (PyObject *)self;
-
+
return 0;
}
if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj))
return -1;
-
+
if (!obj)
self->uf1D_vec2f = new UnaryFunction1D<Vec2f>();
else {
self->uf1D_vec2f = new UnaryFunction1D<Vec2f>(IntegrationType_from_BPy_IntegrationType(obj));
}
-
+
self->uf1D_vec2f->py_uf1D = (PyObject *)self;
-
+
return 0;
}
if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj))
return -1;
-
+
if (!obj)
self->uf1D_vec3f = new UnaryFunction1D<Vec3f>();
else {
self->uf1D_vec3f = new UnaryFunction1D<Vec3f>(IntegrationType_from_BPy_IntegrationType(obj));
}
-
+
self->uf1D_vec3f->py_uf1D = (PyObject *)self;
-
+
return 0;
}
if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj))
return -1;
-
+
if (!obj) {
self->uf1D_vectorviewshape = new UnaryFunction1D< std::vector<ViewShape*> >();
}
else {
self->uf1D_vectorviewshape = new UnaryFunction1D< std::vector<ViewShape*> >(IntegrationType_from_BPy_IntegrationType(obj));
}
-
+
self->uf1D_vectorviewshape->py_uf1D = (PyObject *)self;
-
+
return 0;
}
ViewShape *v = self->uf1D_vectorviewshape->result[i];
PyList_SET_ITEM(list, i, v ? BPy_ViewShape_from_ViewShape(*v) : (Py_INCREF(Py_None), Py_None));
}
-
+
return list;
}
if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj))
return -1;
-
+
if (!obj)
self->uf1D_void = new UnaryFunction1D_void();
else {
self->uf1D_void = new UnaryFunction1D_void(IntegrationType_from_BPy_IntegrationType(obj));
}
-
+
self->uf1D_void->py_uf1D = (PyObject *)self;
-
+
return 0;
}
* - TRIANGLES : the face indices describe single triangles
* If iCopy != 0, the array is copied; you must desallocate iFaceStyle. Else you must not.
* iVIndices,
- * Array of vertices indices.
+ * Array of vertices indices.
* The integers contained in this array must be multiple of 3.
* If iCopy != 0, the array is copied; you must desallocate iVIndices. Else you must not.
* iVISize
real YMin = _vertices.front()[1];
real ZMin = _vertices.front()[2];
- // parse all the coordinates to find
+ // parse all the coordinates to find
// the XMax, YMax, ZMax
vector<Vec3r>::iterator v;
for (v = _vertices.begin(); v != _vertices.end(); ++v) {
protected:
-private:
+private:
BBox<Vec3r> _BBox;
#ifdef WITH_CXX_GUARDEDALLOC
} CameraType;
/*! Default matrices: Identity for both projection and modelview. */
- NodeCamera(CameraType camera_type = GENERIC);
+ NodeCamera(CameraType camera_type = GENERIC);
#if 0 /* UNUSED, gives warning in gcc */
NodeCamera(const NodeCamera& iBrother);
#endif
/*! Adds a child. Makes a addRef on the iChild reference counter */
virtual void AddChild(Node *iChild);
- /*! destroys all the underlying nodes
+ /*! destroys all the underlying nodes
* Returns the reference counter after having done a release()
*/
virtual int destroy();
_number = 7;
}
else {
- _number = numberOfLights;
+ _number = numberOfLights;
numberOfLights++;
}
_number = 7;
}
else {
- _number = numberOfLights;
+ _number = numberOfLights;
numberOfLights++;
}
class NodeLight : public Node
{
public:
- NodeLight();
+ NodeLight();
NodeLight(NodeLight& iBrother);
virtual ~NodeLight() {}
return *this;
}
- virtual ~Rep()
+ virtual ~Rep()
{
if (0 != _FrsMaterial) {
delete _FrsMaterial;
* \date 16/12/2002
*/
-//! inherits from class Rep
+//! inherits from class Rep
#include "Rep.h"
namespace Freestyle {
int _level;
public:
- /*! Builds the functor from name of the
+ /*! Builds the functor from name of the
* Map that must be read.
* \param iMapName
* The name of the map.
int _level;
public:
- /*! Builds the functor
+ /*! Builds the functor
* \param level
* The level of the pyramid from which the pixel must be read.
*/
float _step;
public:
- /*! Builds the functor
+ /*! Builds the functor
* \param level
* The level of the pyramid from which the pixel must be read.
*/
//soc unsigned size;
result = integrate(_fun, inter.pointsBegin(_sampling), inter.pointsEnd(_sampling), _integration);
return 0;
-}
+}
int GetCompleteViewMapDensityF1D::operator()(Interface1D& inter)
{
public:
/*! Builds the functor.
* \param level
- * The level of the pyramid from which
+ * The level of the pyramid from which
* the pixel must be read.
* \param iType
* The integration method used to compute
protected:
real _maxThickness;
real _minThickness;
- Vec2f _orientation;
+ Vec2f _orientation;
bool _clamp;
};
class BackboneStretcherShader : public StrokeShader
{
private:
- float _amount;
+ float _amount;
public:
/*! Builds the shader.
* 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()
+ PolygonalizationShader(float iError) : StrokeShader()
{
_error = iError;
}
virtual int shade(Stroke &stroke) const;
protected:
- real _tipLength;
+ real _tipLength;
};
/*! [ Texture Shader ].
void Clear();
/* Erases the layers */
- virtual void Erase();
+ virtual void Erase();
/* Reads a pixel area from the canvas */
virtual void readColorPixels(int x, int y, int w, int h, RGBImage& oImage) const = 0;
{
_internalIterator = iBrother._internalIterator;
_restrictToSelection = iBrother._restrictToSelection;
- _restrictToUnvisited = iBrother._restrictToUnvisited;
+ _restrictToUnvisited = iBrother._restrictToUnvisited;
return *this;
}
*/
virtual int traverse(const AdjacencyIterator& it);
- /*! Inits the iterator context */
+ /*! Inits the iterator context */
virtual int init()
{
return 0;
void LoadMapCF(const char *iFileName, const char *iMapName, unsigned iNbLevels = 4, float iSigma = 1.0f);
// ReadMapPixel
-/*! Reads a pixel in a user-defined map
+/*! Reads a pixel in a user-defined map
* \return the floating value stored for that pixel
* \param iMapName
* The name of the map
if (__A == 0)
return __B->shape_importance();
return __A->shape_importance();
-}
+}
const unsigned CurvePoint::qi() const
return _Point3d.z();
}
- /*! Returns the 3D point. */
+ /*! Returns the 3D point. */
virtual Vec3r getPoint3D() const
{
return _Point3d;
return _Point2d.z();
}
- /*! Returns the 2D point. */
+ /*! Returns the 2D point. */
virtual Vec2r getPoint2D() const
{
return Vec2r(_Point2d.x(), _Point2d.y());
}
/*! Adds a single vertex (SVertex) at the end of the Curve */
- inline void push_vertex_back(SVertex *iVertex)
+ inline void push_vertex_back(SVertex *iVertex)
{
if (!_Vertices.empty()) {
Vec3r vec_tmp(iVertex->point2d() - _Vertices.back()->point2d());
}
/*! Adds a single vertex (CurvePoint) at the front of the Curve */
- inline void push_vertex_front(Vertex *iVertex)
+ inline void push_vertex_front(Vertex *iVertex)
{
if (!_Vertices.empty()) {
Vec3r vec_tmp(iVertex->point2d() - _Vertices.front()->point2d());
}
/*! Adds a single vertex (SVertex) at the front of the Curve */
- inline void push_vertex_front(SVertex *iVertex)
+ inline void push_vertex_front(SVertex *iVertex)
{
if (!_Vertices.empty()) {
Vec3r vec_tmp(iVertex->point2d() - _Vertices.front()->point2d());
public:
typedef deque<CurvePoint*> vertex_container;
typedef vertex_container::const_iterator vertex_container_iterator;
- typedef SVertex vertex_type;
+ typedef SVertex vertex_type;
};
class CurvePoint_nonconst_traits : public Nonconst_traits<CurvePoint*>
public:
typedef deque<CurvePoint*> vertex_container;
typedef vertex_container::iterator vertex_container_iterator;
- typedef SVertex vertex_type;
+ typedef SVertex vertex_type;
};
/**********************************/
}
}
- virtual void decrement()
+ virtual void decrement()
{
if (_Point != 0) {
delete _Point;
namespace CurveInternal {
-/*! iterator on a curve. Allows an iterating outside
+/*! iterator on a curve. Allows an iterating outside
* initial vertices. A CurvePoint is instanciated an returned
* when the iterator is dereferenced.
*/
class CurvePointIterator : public Interface0DIteratorNested
-{
+{
public:
friend class Freestyle::Curve;
if (newId == 0) {
newId = new Id(_curve->getId());
_curve->setSplittingId(newId);
- }
+ }
Chain *new_curve_a = new Chain(*newId);
newId->setSecond(newId->getSecond() + 1);
if (!splitted_chains.empty()) {
for (cit = splitted_chains.begin(), citend = splitted_chains.end(); cit != citend; ++cit) {
delete (*cit);
- }
+ }
splitted_chains.clear();
- }
+ }
_current_chains_set.clear();
#if 0
Vec2r previous = current;
SVertex *sv;
CurvePoint *cp;
- StrokeVertex *stroke_vertex = NULL;
+ StrokeVertex *stroke_vertex = NULL;
bool hasSingularity = false;
do {
* \param pred
* The predicate on the ViewEdge that expresses the stopping condition.
*/
- static int chain(ViewEdgeInternal::ViewEdgeIterator& it, UnaryPredicate1D& pred);
+ 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
* \param iBegin
* The iterator pointing to the first vertex.
* \param iEnd
- * The iterator pointing to the end of the vertex list.
+ * The iterator pointing to the end of the vertex list.
*/
template<class InputVertexIterator>
Stroke(InputVertexIterator iBegin, InputVertexIterator iEnd);
* Resamples the curve with a given sampling.
* If this sampling is < to the actual sampling value, no resampling is done.
* \param iSampling
- * The new sampling value.
+ * The new sampling value.
*/
int Resample(float iSampling);
*/
void RemoveAllVertices();
- /*! Removes the stroke vertex iVertex
+ /*! Removes the stroke vertex iVertex
* from the stroke.
* The length and curvilinear abscissa are updated
* consequently.
static string _patterns_path;
static string _brushes_path;
unsigned int _defaultTextureId;
-
+
#ifdef WITH_CXX_GUARDEDALLOC
MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:TextureManager")
#endif
#if 0
_averageTextureAlpha = 0.5; //default value
if (_strokeType == OIL_STROKE)
- _averageTextureAlpha = 0.75;
+ _averageTextureAlpha = 0.75;
if (_strokeType >= NO_BLEND_STROKE)
_averageTextureAlpha = 1.0;
#endif
// Purpose : Class to define the text rendering of a stroke
// Format:
// x y width height // bbox
-// //list of vertices :
+// //list of vertices :
// t x y z t1 t2 r g b alpha ...
// ...
// Date of creation : 01/14/2005
_first = iBrother._first;
_second = iBrother._second;
return *this;
- }
+ }
/*! Returns the first Id number */
id_type getFirst() const
}
ArbitraryGridDensityProvider::ArbitraryGridDensityProvider(OccluderSource& source, unsigned numCells)
-: GridDensityProvider(source), numCells(numCells)
+: GridDensityProvider(source), numCells(numCells)
{
real proscenium[4];
calculateOptimalProscenium(source, proscenium);
fe = fe->nextEdge();
}
- // If bestOccluderTarget was not found inside the occluder proscenium,
+ // 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
FEdge *festart = (*ve)->fedgeA();
FEdge *fe = festart;
do {
- // If not (already) visible and center point inside occluder proscenium,
+ // If not (already) visible and center point inside occluder proscenium,
if (!fe->isInImage() && insideProscenium(occluderProscenium, fe->center2d())) {
// Use the feature edge for visibility determination
fe->setIsInImage(true);
Vec3r e1, n, v;
// one vertex curvature info :
CurvatureInfo *C;
- float radius = _sphereRadius * _meanEdgeSize;
+ float radius = _sphereRadius * _meanEdgeSize;
// view independent stuff
if (_computeViewIndependent) {
if (!_computeViewIndependent)
return;
- // Make a pass on the edges to detect the CREASE
+ // Make a pass on the edges to detect the CREASE
vector<WEdge*>::iterator we, weend;
vector<WEdge*> &wedges = iWShape->getEdgeList();
for (we = wedges.begin(), weend = wedges.end(); we != weend; ++we) {
if ((N1.norm() == 0) && (N2.norm() == 0)) {
Exception::raiseException();
result = 0;
- return -1;
+ return -1;
}
double cosin = N1 * N2;
if (cosin > 1)
}
/*! The operator ().
- * \param inter
+ * \param inter
* The Interface1D on which we wish to evaluate the function.
* \return the result of the function of type T.
*/
return _Point3D.z();
}
- /*! Returns the 3D point. */
+ /*! Returns the 3D point. */
virtual Vec3r getPoint3D() const
{
return _Point3D;
return _Point2D.z();
}
- /*! Returns the 2D point. */
+ /*! Returns the 2D point. */
virtual Vec2r getPoint2D() const
{
return Vec2r(_Point2D.x(), _Point2D.y());
/*! Returns the nature of the vertex .*/
virtual Nature::VertexNature getNature() const;
- /*! Cast the Interface0D in SVertex if it can be. */
+ /*! Cast the Interface0D in SVertex if it can be. */
virtual SVertex *castToSVertex();
- /*! Cast the Interface0D in ViewVertex if it can be. */
+ /*! Cast the Interface0D in ViewVertex if it can be. */
virtual ViewVertex *castToViewVertex();
- /*! Cast the Interface0D in NonTVertex if it can be. */
+ /*! Cast the Interface0D in NonTVertex if it can be. */
virtual NonTVertex *castToNonTVertex();
- /*! Cast the Interface0D in TVertex if it can be. */
+ /*! Cast the Interface0D in TVertex if it can be. */
virtual TVertex *castToTVertex();
public:
Id _Id;
Vec3r _Point3D;
Vec3r _Point2D;
- set<Vec3r> _Normals;
+ set<Vec3r> _Normals;
vector<FEdge*> _FEdges; // the edges containing this vertex
SShape *_Shape; // the shape to which belongs the vertex
ViewVertex *_pViewVertex; // The associated viewvertex, in case there is one.
unsigned _FrsMaterialIndex;
#if 0
bool _hasVisibilityPoint;
- Vec3r _VisibilityPointA; // The edge on which the visibility will be computed represented
+ Vec3r _VisibilityPointA; // The edge on which the visibility will be computed represented
Vec3r _VisibilityPointB; // using its 2 extremity points A and B
#endif
- void *_Face; // In case of exact silhouette, Face is the WFace crossed by Fedge
+ void *_Face; // In case of exact silhouette, Face is the WFace crossed by Fedge
// NOT HANDLED BY THE COPY CONSTRUCTEUR
bool _FaceMark;
const char *_Name;
const char *_LibraryPath;
BBox<Vec3r> _BBox;
- vector<FrsMaterial> _FrsMaterials;
+ vector<FrsMaterial> _FrsMaterials;
float _importance;
// Accessors:
bool orthographicProjection() const;
const Vec3r& viewpoint() const;
- bool enableQI() const;
+ bool enableQI() const;
private:
void getCellCoordinates(const Vec3r& point, unsigned& x, unsigned& y);
// If the current occluder is the best occludee so far, save it.
if (! _foundOccludee || _occludeeDepth > depth) {
markCurrentOccludeeCandidate(depth);
- }
+ }
}
else {
#if SPHERICAL_GRID_LOGGING
}
delete[] _imagesPyramids;
_imagesPyramids = 0;
- }
+ }
if (!_mapping.empty()) {
for (map<unsigned int, double*>::iterator m = _mapping.begin(), mend = _mapping.end(); m != mend; ++m) {
delete[] (*m).second;
map<unsigned int, double *>::iterator o = _mapping.find(id);
if (o != _mapping.end()) {
double *wvalues = (*o).second;
- double maxw = 0.0;
+ double maxw = 0.0;
unsigned winner = _nbOrientations + 1;
for (unsigned i = 0; i < _nbOrientations; ++i) {
double w = wvalues[i];
class ImagePyramid;
class GrayImage;
-/*! This class checks for every FEdge in which steerable it belongs and stores the mapping allowing to retrieve
+/*! 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
void ViewMap::AddViewShape(ViewShape *iVShape)
{
- _shapeIdToIndex[iVShape->getId().getFirst()] = _VShapes.size();
+ _shapeIdToIndex[iVShape->getId().getFirst()] = _VShapes.size();
_VShapes.push_back(iVShape);
}
if (v1.y() > 0) {
if (v2.y() < 0)
return true;
- else
+ else
return (v1.x() > v2.x());
}
else {
if (v2.y() > 0)
return false;
- else
+ else
return (v1.x() < v2.x());
}
return false;
void TVertex::Replace(ViewEdge *iOld, ViewEdge *iNew)
{
- // theoritically, we only replace edges for which this
+ // theoritically, we only replace edges for which this
// view vertex is the B vertex
if ((iOld == _FrontEdgeA.first) && (_FrontEdgeA.first->B() == this)) {
_FrontEdgeA.first = iNew;
/**********************************/
/* */
/* */
-/* NonTVertex */
+/* NonTVertex */
/* */
/* */
/**********************************/
* iB2D
* The x,y,z 2D coordinates of the projection of iB3D
* iFEdgeB
- * The second FEdge
+ * The second FEdge
* id
* The id that must be given to that TVertex
*/
/**********************************/
/* */
/* */
-/* NonTVertex */
+/* NonTVertex */
/* */
/* */
/**********************************/
ViewEdge *vEdge = fe->viewedge();
// We first need to sort the view vertices from farther to closer to fe->vertexA
- SVertex *sv, *sv2;
+ SVertex *sv, *sv2;
ViewVertex *vva, *vvb;
vector<TVertex*>::const_iterator vv, vvend;
for (vv = iViewVertices.begin(), vvend = iViewVertices.end(); vv != vvend; vv++) {
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 !!!!)
shape->RemoveEdgeFromChain(vEdge->fedgeA());
- // we set
+ // we set
vEdge->setA(*vv);
vEdge->setB(*vv);
vEdge->setFEdgeA(newEdge);
computeInitialViewEdges(we);
// Detects cusps
- computeCusps(_ViewMap);
+ computeCusps(_ViewMap);
// Compute intersections
ComputeIntersections(_ViewMap, sweep_line, epsilon);
cout << "Origin: [" << prosceniumOrigin[0] << ", " << prosceniumOrigin[1] << "]"<< endl;
}
- // A separate occluder proscenium will also be maintained, starting out the same as the viewport proscenium, and
+ // 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.
FEdge *festart = (*ve)->fedgeA();
FEdge *fe = festart;
do {
- // If not (already) visible and center point inside occluder proscenium,
+ // If not (already) visible and center point inside occluder proscenium,
if (!fe->isInImage() && insideProscenium(occluderProscenium, fe->center2d())) {
// Use the feature edge for visibility determination
fe->setIsInImage(true);
for (fe = ioEdges.begin(), fend = ioEdges.end(); fe != fend; fe++)
(*fe)->userdata = NULL;
- // list containing the new edges resulting from splitting operations.
+ // list containing the new edges resulting from splitting operations.
vector<FEdge*> newEdges;
// retrieve the intersected edges:
/*! Builds the scene view map returns the list the view map
* it is up to the caller to delete this ViewMap
* iWRoot
- * The root group node containing the WEdge structured scene
+ * The root group node containing the WEdge structured scene
*/
ViewMap *BuildViewMap(WingedEdge& we, visibility_algo iAlgo, real epsilon, const BBox<Vec3r>& bbox,
unsigned int sceneNumFaces);
/*! Computes the 2D scene silhouette edges visibility
* iGrid
- * For the Ray Casting algorithm.
+ * For the Ray Casting algorithm.
*/
void ComputeEdgesVisibility(ViewMap *ioViewMap, WingedEdge& we, const BBox<Vec3r>& bbox, unsigned int sceneNumFaces,
visibility_algo iAlgo = ray_casting, real epsilon = 1.0e-6);
load(in, v);
fesharp->setNormalB(v);
- // Materials
+ // Materials
READ(matindex);
fesharp->setaFrsMaterialIndex(matindex);
READ(matindex);
#include "ViewMap.h"
-#include "../system/Iterator.h" //soc
+#include "../system/Iterator.h" //soc
namespace Freestyle {