本文整理汇总了C++中Face类的典型用法代码示例。如果您正苦于以下问题:C++ Face类的具体用法?C++ Face怎么用?C++ Face使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Face类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: visit
void visit(Face& face) const
{
if(!m_done)
{
m_done = true;
FaceTexdef_getTexdef(face.getTexdef(), m_projection);
}
}
示例2: NFD_LOG_DEBUG
void
Forwarder::onDataUnsolicited(Face& inFace, const Data& data)
{
// accept to cache?
bool acceptToCache = inFace.isLocal();
if (acceptToCache) {
// CS insert
if (m_csFromNdnSim == nullptr)
m_cs.insert(data, true);
else
m_csFromNdnSim->Add(data.shared_from_this());
}
NFD_LOG_DEBUG("onDataUnsolicited face=" << inFace.getId() <<
" data=" << data.getName() <<
(acceptToCache ? " cached" : " not cached"));
}
示例3: face1
// Morph two faces
// --morphfaces <targa filename1> <targa filename2> <eigenfaces filename> <distance (0.0=first, 1.0=second, in between is a morph)> <outfile name>
void Main::morphFaces()
{
std::string filename1=args.nextArg();
std::string filename2=args.nextArg();
std::string eigfilename=args.nextArg();
double distance = args.nextFloat();
std::string outfilename=args.nextArg();
EigFaces eigenfaces;
eigenfaces.load(eigfilename);
Face face1(eigenfaces.getWidth(), eigenfaces.getHeight());
Face face2(eigenfaces.getWidth(), eigenfaces.getHeight());
Face result;
face1.loadTarga(filename1);
face2.loadTarga(filename2);
eigenfaces.morphFaces(face1, face2, distance, result);
result.saveTarga(outfilename);
}
示例4: Delaunay
Delaunay(float* points, int pointslen) {
this->points = points;
this->pointslen = pointslen;
//查找点集最大最小值
float xa, xi, ya, yi;
xa = points[0];
xi = points[0];
ya = points[1];
yi = points[1];
for (int i = 0; i < pointslen; i++) {
float x = points[i * 2];
float y = points[i * 2 + 1];
xa = xa < x ? x : xa;
xi = xi > x ? x : xi;
ya = ya < y ? y : ya;
yi = yi > y ? y : yi;
}
//构造初始三角网
Face* fistA = new Face();
Face* fistB = new Face();
faceList = fistA;
fistA->next = fistB;
fistA->setPoint0(xi, yi); //-1
fistA->setPoint1(xa, yi); //-2
fistA->setPoint2(xi, ya); //-3
fistB->setPoint0(xa, yi); //-2
fistB->setPoint1(xi, ya); //-3
fistB->setPoint2(xa, ya); //-4
fistB->next = 0;
fistA->pointindex[0] = -1;
fistA->pointindex[1] = -2;
fistA->pointindex[2] = -3;
fistB->pointindex[0] = -2;
fistB->pointindex[1] = -3;
fistB->pointindex[2] = -4;
//初始化lop条件
fistA->edgeFaces[1] = new EdgeFace(fistB, 2);
fistB->edgeFaces[0] = new EdgeFace(fistA, 0);
fistA->lop();
fistB->lop();
for(int i=0;i<pointslen;i++){
float* fp=&points[i*2];
insert(fp);
}
}
示例5: lop
void lop() {
//前提条件,三点顺序在所有三角形中都是顺时针
//提供的两个三角形必须相邻,且index必须已经被赋值
for (int i = 0; i < 3; i++) {
if (edgeFaces[i] == 0)
continue;
if (!isInCircle(edgeFaces[i]->getOtherPoint()))
continue;
//需要进行变换
Face* b = edgeFaces[i]->face;
int bo = edgeFaces[i]->otherPointIndex; //b中的外点
Face* a = this;
int ao = i - 1 >= 0 ? i - 1 : 2; //a中的外点
int la1 = i; //a共线端点
int la2 = i + 1 >= 3 ? 0 : i + 1; //a共线端点
int lb1 = bo + 1 >= 3 ? 0 : bo + 1; //b共线端点
int lb2 = lb1 + 1 >= 3 ? 0 : lb1 + 1; //b共线端点
a->setPoint(la2, b->getPoint(bo));
b->setPoint(lb2, a->getPoint(ao));
a->edgeFaces[la1]->set(b->edgeFaces[lb2]);
a->edgeFaces[la1]->updateOtherFaceForMyEdgeFaceInfo(ao, a);
b->edgeFaces[lb1]->set(a->edgeFaces[la2]);
b->edgeFaces[lb1]->updateOtherFaceForMyEdgeFaceInfo(bo, b);
a->edgeFaces[la2]->face = b;
a->edgeFaces[la2]->otherPointIndex = lb1;
b->edgeFaces[lb2]->face = a;
b->edgeFaces[lb2]->otherPointIndex = la1;
//变换结束后,原三角形的la1不变
i = 0; //重新处理,直到所有相邻三角形都满足lop
b->lop();
}
}
示例6: viiRelatedFaces
void Mesh::calculateVII(float radius)
{
for(std::set<Vertex*>::iterator j=this->mVertices.begin();j!=this->mVertices.end();j++)
{
Vertex* vertex = *j;
float Br = (4/3)*PI*radius;
float Vl = 0.0f;
float Vp = 0.0f;
std::set<Face*> catA,catB,catC;
viiRelatedFaces(vertex,radius,catA,catB,catC);
//Vp ungenau momentan. toDo: genauer
for(std::set<Face*>::iterator i = catA.begin();i!=catA.end();i++)
{
Face* face = *i;
Vector3 vecA = face->getA()->getPosition();
Vector3 vecB = face->getB()->getPosition();
Vector3 vecC = face->getC()->getPosition();
vecA.setY(0);
vecB.setY(0);
vecC.setY(0);
Vector3 area = (vecB-vecA).crossProduct(vecC-vecA);
float aj = area.getLength() / 2;
Vector3 s = face->getA()->getPosition() + face->getB()->getPosition() + face->getC()->getPosition();
s /= 3;
Vp += s.getY() * aj;
//Vp += s.getY();
}
float volumeIntegralInvariant = Vl+Vp+(Br/2);
}
}
示例7: removeFace
void Mesh::collapse(Vertex* v1, Vertex* v2)
{
std::vector<Face*>::iterator i;
for (i = v1->adjacentFaces().begin(); i != v1->adjacentFaces().end(); ++i){
Face* f = *i;
if (f->hasVertex(v2)) {
removeFace(f);
// delete f;
}
}
Vector3 position1 = v1->position();
int weight1 = v1->weight();
Vector3 position2 = v2->position();
int weight2 = v2->weight();
Vector3 newPosition = (position1 * weight1 + position2 * weight2) / (weight1 + weight2);
v2->setPosition(newPosition);
v2->setWeight(v1->weight() + v2->weight());
for (i = v1->adjacentFaces().begin(); i != v1->adjacentFaces().end(); ++i){
Face* f = *i;
f->changeVertex(v1, v2);
f->calculateNormal();
}
std::vector<Vertex*>::iterator j;
for (j = v1->adjacentVertices().begin(); j != v1->adjacentVertices().end(); ++j){
Vertex* v = *j;
v->removeAdjacentVertex(v1);
v->addAdjacentVertex(v2);
Edge* e = getEdge(v1, v);
if (e) {
if (e->hasVertex(v2)) {
removeEdge(e);
//delete e; // FIXME: pointer being freed was not allocated
} else {
e->changeVertex(v1, v2);
}
} else {
std::cerr << "missing edge" << v1->index() << "/" << v->index() << "\n";
}
}
}
示例8: splitFace
Vec3f Brush::splitFace(const FaceInfo& faceInfo, const Vec3f& delta) {
FaceSet newFaces;
FaceSet droppedFaces;
Vec3f newVertexPosition = m_geometry->splitFace(m_worldBounds, faceInfo, delta, newFaces, droppedFaces);
for (FaceSet::iterator it = droppedFaces.begin(); it != droppedFaces.end(); ++it) {
Face* dropFace = *it;
dropFace->setBrush(NULL);
m_faces.erase(std::remove(m_faces.begin(), m_faces.end(), dropFace), m_faces.end());
delete dropFace;
}
for (FaceList::iterator it = m_faces.begin(); it != m_faces.end(); ++it) {
Face* face = *it;
face->invalidateTexAxes();
face->invalidateVertexCache();
}
for (FaceSet::iterator it = newFaces.begin(); it != newFaces.end(); ++it) {
Face* newFace = *it;
newFace->setBrush(this);
m_faces.push_back(newFace);
}
setNeedsRebuild(true);
return newVertexPosition;
}
示例9: assign_kuv_to_edge
int superMi::assign_kuv_to_edge(Solid* mesh)
{
for (SolidEdgeIterator seiter(mesh); !seiter.end(); ++seiter){
Edge* se = *seiter;
se->kuv_h() = 0.0;
//Point p1 = mesh->edgeVertex1(se)->point();
//Point p3 = mesh->edgeVertex2(se)->point();
//HalfEdge* he2 = se->halfedge(0)->ccw_rotate_about_source();
//HalfEdge* he4 = se->halfedge(0)->clw_rotate_about_source();
//Point p2 = he2->target()->point();
//Point p4 = he4->target()->point();
//double alpha = ((p3 - p2)*(p1 - p2) / ((p3 - p2) ^ (p1 - p2)).norm()) / 2.0;
//double beta = ((p3 - p4)*(p1 - p4) / ((p3 - p4) ^ (p1 - p4)).norm()) / 2.0;
//se->kuv_h() = alpha + beta;
HalfEdge* he = se->halfedge(0);
HalfEdge* nhe = he->he_next();
HalfEdge* phe = he->he_prev();
Face* hef = he->face();
double nhel = (nhe->target()->point() - nhe->source()->point()).norm();
double phel = (phe->target()->point() - phe->source()->point()).norm();
double hel = (he->target()->point() - he->source()->point()).norm();
se->kuv_h() += (nhel*nhel + phel*phel - hel*hel) / hef->area() / 8.0;
he = se->halfedge(1);
nhe = he->he_next();
phe = he->he_prev();
hef = he->face();
nhel = (nhe->target()->point() - nhe->source()->point()).norm();
phel = (phe->target()->point() - phe->source()->point()).norm();
se->kuv_h() += (nhel*nhel + phel*phel - hel*hel) / hef->area() / 8.0;
se->kuv_t() = 1.0;
//std::cout << se->kuv() << std::endl;
}
return 0;
}
示例10: setNeedsRebuild
FaceInfoList Brush::moveFaces(const FaceInfoList& faceInfos, const Vec3f& delta) {
FaceSet newFaces;
FaceSet droppedFaces;
const FaceInfoList newFaceInfos = m_geometry->moveFaces(m_worldBounds, faceInfos, delta, newFaces, droppedFaces);
for (FaceSet::iterator it = droppedFaces.begin(); it != droppedFaces.end(); ++it) {
Face* face = *it;
face->setBrush(NULL);
m_faces.erase(std::remove(m_faces.begin(), m_faces.end(), face), m_faces.end());
delete face;
}
for (FaceList::iterator it = m_faces.begin(); it != m_faces.end(); ++it) {
Face* face = *it;
face->invalidateTexAxes();
face->invalidateVertexCache();
}
for (FaceSet::iterator it = newFaces.begin(); it != newFaces.end(); ++it) {
Face* face = *it;
face->setBrush(this);
m_faces.push_back(face);
}
setNeedsRebuild(true);
return newFaceInfos;
}
示例11: FakeFace
Face *Carriers::listen(const Contact& address) {
// for now, only TcpFace exists - otherwise would need to manage
// multiple possibilities
//YARP_DEBUG(carriersLog,"listen called");
Face *face = NULL;
if (address.getCarrier() == "fake") {
face = new FakeFace();
}
if (face == NULL) {
face = new TcpFace();
}
bool ok = face->open(address);
if (!ok) {
delete face;
face = NULL;
}
return face;
}
示例12: do_tesselate_face
bool do_tesselate_face( const Face &F, tesscb_estimator* cb_E, int &max_id )
{
if (F.CalcArea()<EPS_L)
return false;//continue;
max_id = cb_E(&F);
if (max_id<0)
return false;//continue; // nothing selected
return true;
}
示例13: sendInterest
virtual void
sendInterest(const shared_ptr<pit::Entry>& pitEntry,
Face& outFace,
bool wantNewNonce = false) override
{
sendInterestHistory.push_back({pitEntry->getInterest(), outFace.getId(), wantNewNonce});
pitEntry->insertOrUpdateOutRecord(outFace, pitEntry->getInterest());
afterAction();
}
示例14: NFD_LOG_DEBUG
void
Forwarder::onInterestLoop(Face& inFace, const Interest& interest,
shared_ptr<pit::Entry> pitEntry)
{
NFD_LOG_DEBUG("onInterestLoop face=" << inFace.getId() <<
" interest=" << interest.getName());
// (drop)
}
示例15: NFD_LOG_DEBUG
void
Strategy::afterContentStoreHit(const shared_ptr<pit::Entry>& pitEntry,
const Face& inFace, const Data& data)
{
NFD_LOG_DEBUG("afterContentStoreHit pitEntry=" << pitEntry->getName() <<
" inFace=" << inFace.getId() << " data=" << data.getName());
this->sendData(pitEntry, data, inFace);
}