Пример #1
0
void FEdgeXDetector::ProcessSuggestiveContourFace(WXFace *iFace)
{
	WXFaceLayer *faceLayer = new WXFaceLayer(iFace, Nature::SUGGESTIVE_CONTOUR, true);
	iFace->AddSmoothLayer(faceLayer);

	unsigned int numVertices = iFace->numberOfVertices();
	for (unsigned int i = 0; i < numVertices; ++i) {
		WVertex *wv = iFace->GetVertex(i);
		WXVertex *wxv = dynamic_cast<WXVertex*>(wv);
		faceLayer->PushDotP(wxv->curvatures()->Kr);
	}

#if 0 // FIXME: find a more clever way to compute the threshold
	real threshold = _meanKr;
	if (faceLayer->nPosDotP()!=numVertices) {
		if ((fabs(faceLayer->dotP(0)) < threshold) && (fabs(faceLayer->dotP(1)) < threshold) &&
		    (fabs(faceLayer->dotP(2)) < threshold))
		{
			faceLayer->ReplaceDotP(0, 0);
			faceLayer->ReplaceDotP(1, 0);
			faceLayer->ReplaceDotP(2, 0);
		}
	}
#endif
}
Пример #2
0
// RIDGES
/////////
void FEdgeXDetector::ProcessRidgeFace(WXFace *iFace)
{
	WXFaceLayer *flayer = new WXFaceLayer(iFace, Nature::RIDGE | Nature::VALLEY, false);
	iFace->AddSmoothLayer(flayer);

	unsigned int numVertices = iFace->numberOfVertices();
	for (unsigned int i = 0; i < numVertices; ++i) {
		WVertex *wv = iFace->GetVertex(i);
		WXVertex *wxv = dynamic_cast<WXVertex*>(wv);
		flayer->PushDotP(wxv->curvatures()->K1);
	}

#if 0 // XXX fabs(flayer->dotP(i)) < threshold cannot be true
	real threshold = 0;
	//real threshold = _maxK1 - (_maxK1 - _meanK1) / 20.0;

	if (flayer->nPosDotP() != numVertices) {
		if ((fabs(flayer->dotP(0)) < threshold) && (fabs(flayer->dotP(1)) < threshold) &&
		    (fabs(flayer->dotP(2)) < threshold))
		{
			flayer->ReplaceDotP(0, 0);
			flayer->ReplaceDotP(1, 0);
			flayer->ReplaceDotP(2, 0);
		}
	}
#endif
}