26 #include "../geometry/GeomUtils.h"
27 #include "../geometry/normal_cycle.h"
35 bool progressBarDisplay =
false;
47 progressBarDisplay =
true;
50 for (vector<WShape *>::const_iterator it = wshapes.begin(); it != wshapes.end(); it++) {
54 wxs =
dynamic_cast<WXShape *
>(*it);
57 _bbox_diagonal = (Max - Min).
norm();
61 for (vector<WFace *>::iterator wf = wfaces.begin(), wfend = wfaces.end(); wf != wfend;
68 else if (!(wxs)->getComputeViewIndependentFlag()) {
76 if (progressBarDisplay) {
92 if (progressBarDisplay) {
103 if (progressBarDisplay) {
112 (*it)->ResetUserData();
134 vector<WFace *>::iterator f, fend;
136 for (f = wfaces.begin(), fend = wfaces.end(); f != fend; ++f) {
142 for (vector<WVertex *>::iterator wv = wvertices.begin(), wvend = wvertices.end(); wv != wvend;
187 printf(
"Warning: WVertex %d has no associated edges.\n", vertex->
GetId());
196 real cos2theta, sin2theta;
215 C->K1 = ncycle.
kmin();
216 C->K2 = ncycle.
kmax();
217 C->e1 = ncycle.
Kmax();
218 C->e2 = ncycle.
Kmin();
243 C->er =
v - (
v * n) * n;
247 cos2theta =
C->er * e1;
248 cos2theta *= cos2theta;
249 sin2theta = 1 - cos2theta;
250 C->Kr =
C->K1 * cos2theta +
C->K2 * sin2theta;
269 vector<WFace *>::iterator f, fend;
270 for (f = wfaces.begin(), fend = wfaces.end(); f != fend; ++f) {
275 vector<WEdge *>::iterator we, weend;
277 for (we = wedges.begin(), weend = wedges.end(); we != weend; ++we) {
288 int closestPointId = 0;
289 float dist, minDist = FLT_MAX;
312 dist = dist_vec.
norm();
314 if (dist < minDist) {
362 vector<WEdge *>::iterator we, weend;
364 for (we = wedges.begin(), weend = wedges.end(); we != weend; ++we) {
388 vector<WEdge *>::iterator we, weend;
390 for (we = wedges.begin(), weend = wedges.end(); we != weend; ++we) {
424 vector<WFace *>::iterator f, fend;
425 for (f = wfaces.begin(), fend = wfaces.end(); f != fend; ++f) {
449 if ((
fabs(flayer->
dotP(0)) < threshold) && (
fabs(flayer->
dotP(1)) < threshold) &&
450 (
fabs(flayer->
dotP(2)) < threshold)) {
467 vector<WXFaceLayer *> SmoothLayers;
470 real K1_a(0), K1_b(0);
471 Vec3r Inter_a, Inter_b;
475 if (SmoothLayers.size() != 1) {
478 faceLayer = SmoothLayers[0];
480 layer_info = (Face_Curvature_Info *)faceLayer->
userdata;
490 WVertex::face_iterator fit =
v->faces_begin();
491 WVertex::face_iterator fitend =
v->faces_end();
492 for (; fit != fitend; ++fit) {
493 WXFace *wxf =
dynamic_cast<WXFace *
>(*fit);
494 WOEdge *oppositeEdge;
495 if (!(wxf->getOppositeEdge(
v, oppositeEdge))) {
498 v1v2 = oppositeEdge->GetbVertex()->GetVertex() - oppositeEdge->GetaVertex()->GetVertex();
501 oppositeEdge->GetaVertex()->GetVertex(), v1v2, e2, -(
v->GetVertex() * e2),
t, 1.0e-06);
503 vector<WXFaceLayer *> second_ridge_layer;
504 wxf->retrieveSmoothLayers(
Nature::RIDGE, second_ridge_layer);
505 if (second_ridge_layer.size() != 1) {
508 Face_Curvature_Info *second_layer_info =
509 (Face_Curvature_Info *)second_ridge_layer[0]->userdata;
511 unsigned index1 = wxf->GetIndex(oppositeEdge->GetaVertex());
512 unsigned index2 = wxf->GetIndex(oppositeEdge->GetbVertex());
513 real K1_1 = second_layer_info->vec_curvature_info[index1]->K1;
514 real K1_2 = second_layer_info->vec_curvature_info[index2]->K1;
515 real K1 = (1.0 -
t) * K1_1 +
t * K1_2;
516 Vec3r inter((1.0 -
t) * oppositeEdge->GetaVertex()->GetVertex() +
517 t * oppositeEdge->GetbVertex()->GetVertex());
518 Vec3r vtmp(inter -
v->GetVertex());
536 d = (K1_b) - (K1_a) / (Inter_b - Inter_a).
norm();
560 if ((faceLayer->
dotP(0) < minDiff) && (faceLayer->
dotP(1) < minDiff) && (faceLayer->
dotP(2) < minDiff)) {
576 vector<WFace *>::iterator f, fend;
577 for (f = wfaces.begin(), fend = wfaces.end(); f != fend; ++f) {
597 if ((
fabs(faceLayer->
dotP(0)) < threshold) && (
fabs(faceLayer->
dotP(1)) < threshold) &&
598 (
fabs(faceLayer->
dotP(2)) < threshold)) {
610 vector<WFace *>::iterator f, fend;
611 for (f = wfaces.begin(), fend = wfaces.end(); f != fend; ++f) {
623 vector<WXFaceLayer *> sc_layers;
625 if (sc_layers.empty()) {
630 sc_layer = sc_layers[0];
633 vector<real> kr_derivatives;
636 WXVertex *
v, *opposite_vertex_a, *opposite_vertex_b;
639 Vec3r normal_vec, radial_normal_vec, er_vec, v_vec, inter, inter1, inter2, tmp_vec;
641 real kr(0), kr1(0), kr2(0),
t;
643 for (
unsigned int i = 0; i < vertices_nb; ++i) {
647 if (
v->isBoundary()) {
648 kr_derivatives.push_back(0);
652 v_vec =
v->GetVertex();
653 er_vec =
v->curvatures()->er;
658 wxf =
dynamic_cast<WXFace *
>(*fit);
666 radial_normal_vec = er_vec ^ normal_vec;
672 -(v_vec * radial_normal_vec),
681 tmp_vec = inter -
v->GetVertex();
683 if (tmp_vec * er_vec > 0) {
698 v->curvatures()->dKr = (kr2 - kr1) / (inter2 - inter1).norm();
699 kr_derivatives.push_back(
v->curvatures()->dKr);
714 sc_oedge = sc_edge->
woeb();
731 vector<WEdge *>::iterator we, weend;
733 for (we = wedges.begin(), weend = wedges.end(); we != weend; ++we) {
753 vector<WEdge *>::iterator we, weend;
755 for (we = wedges.begin(), weend = wedges.end(); we != weend; ++we) {
771 bool hasSmoothEdges =
false;
776 for (vector<WFace *>::iterator f = wfaces.begin(), fend = wfaces.end(); f != fend; ++f) {
777 vector<WXFaceLayer *> &faceLayers = ((
WXFace *)(*f))->getSmoothLayers();
778 for (vector<WXFaceLayer *>::iterator wxfl = faceLayers.begin(), wxflend = faceLayers.end();
781 if ((*wxfl)->BuildSmoothEdge()) {
782 hasSmoothEdges =
true;
789 for (vector<WVertex *>::iterator wv = wvertices.begin(), wvend = wvertices.end(); wv != wvend;
Detects/flags/builds extended features edges on the WXEdge structure.
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble y2 _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat y2 _GL_VOID_RET _GL_VOID GLint GLint GLint y2 _GL_VOID_RET _GL_VOID GLshort GLshort GLshort y2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLuint *buffer _GL_VOID_RET _GL_VOID GLdouble t _GL_VOID_RET _GL_VOID GLfloat t _GL_VOID_RET _GL_VOID GLint t _GL_VOID_RET _GL_VOID GLshort t _GL_VOID_RET _GL_VOID GLdouble t
ATTR_WARN_UNUSED_RESULT const BMVert * v
SIMD_FORCE_INLINE btScalar norm() const
Return the norm (length) of the vector.
virtual void processRidgesAndValleysShape(WXShape *iWShape)
virtual void ProcessBorderEdge(WXEdge *iEdge)
bool _computeMaterialBoundaries
virtual void processShapes(WingedEdge &)
virtual void ProcessMaterialBoundaryEdge(WXEdge *iEdge)
virtual void processEdgeMarksShape(WXShape *iShape)
virtual void processCreaseShape(WXShape *iWShape)
virtual void ProcessEdgeMarks(WXEdge *iEdge)
virtual void ProcessRidgeFace(WXFace *iFace)
virtual void processMaterialBoundaryShape(WXShape *iWShape)
virtual void preProcessFace(WXFace *iFace)
virtual void ProcessSilhouetteFace(WXFace *iFace)
virtual void buildSmoothEdges(WXShape *iShape)
virtual void preProcessShape(WXShape *iWShape)
RenderMonitor * _pRenderMonitor
virtual void computeCurvatures(WXVertex *iVertex)
float _kr_derivative_epsilon
virtual void processSuggestiveContourShape(WXShape *iWShape)
ProgressBar * _pProgressBar
virtual void processSilhouetteShape(WXShape *iWShape)
bool _computeRidgesAndValleys
bool _orthographicProjection
virtual void ProcessSilhouetteEdge(WXEdge *iEdge)
virtual void postProcessSuggestiveContourShape(WXShape *iShape)
virtual void ProcessCreaseEdge(WXEdge *iEdge)
bool _computeSuggestiveContours
bool _computeViewIndependent
virtual void ProcessSuggestiveContourFace(WXFace *iFace)
virtual void postProcessSuggestiveContourFace(WXFace *iFace)
virtual void processBorderShape(WXShape *iWShape)
vector< CurvatureInfo * > vec_curvature_info
const Vec3r & Kmin() const
const Vec3r & Kmax() const
virtual void setLabelText(const string &s)
virtual void setProgress(unsigned i)
unsigned int getProgress() const
virtual void setTotalSteps(unsigned n)
Vec< T, N > & normalize()
unsigned frs_materialIndex() const
Vec3f & GetVertexNormal(int index)
int numberOfVertices() const
bool getOppositeEdge(const WVertex *v, WOEdge *&e)
WVertex * GetVertex(unsigned int index)
int GetIndex(WVertex *iVertex)
vector< WEdge * > & getEdgeList()
real ComputeMeanEdgeSize() const
vector< WVertex * > & getVertexList()
vector< WFace * > & GetFaceList()
vector< WEdge * > & GetEdges()
void AddNature(WXNature iNature)
const float dotP(int i) const
void setClosestPointIndex(int iIndex)
void PushDotP(float iDotP)
void ReplaceDotP(unsigned int index, float newDotP)
unsigned nPosDotP() const
WXSmoothEdge * getSmoothEdge()
void setDotP(float iDotP)
void retrieveSmoothLayers(WXNature iNature, vector< WXFaceLayer * > &oSmoothLayers)
void retrieveSmoothEdgesLayers(WXNature iNature, vector< WXFaceLayer * > &oSmoothEdgesLayers)
void AddSmoothLayer(WXFaceLayer *iLayer)
void setComputeViewIndependentFlag(bool iFlag)
void setCurvatures(CurvatureInfo *ci)
CurvatureInfo * curvatures()
vector< WShape * > & getWShapes()
IconTextureDrawCall normal
intersection_test intersectRayPlane(const Vec3r &orig, const Vec3r &dir, const Vec3r &norm, const real d, real &t, const real epsilon)
VecMat::Vec3< real > Vec3r
static const EdgeNature BORDER
static const EdgeNature MATERIAL_BOUNDARY
static const EdgeNature EDGE_MARK
static const EdgeNature VALLEY
static const EdgeNature CREASE
static const EdgeNature RIDGE
static const EdgeNature SILHOUETTE
static const EdgeNature SUGGESTIVE_CONTOUR
void compute_curvature_tensor(WVertex *start, real radius, NormalCycle &nc)
void compute_curvature_tensor_one_ring(WVertex *start, NormalCycle &nc)
ccl_device_inline float2 fabs(const float2 &a)
CCL_NAMESPACE_BEGIN struct View V