CEntity_StaticMesh::CEntity_StaticMesh( const std::vector< CRenderable_AbstractMaterial > in_Materials ,const std::vector< CRenderable_BoneRemap >& in_RemappedGeometries ,CBone* in_pRootBone ) : m_Skeleton(in_pRootBone) ,m_RemappedGeometries(in_RemappedGeometries) ,m_Materials(in_Materials) { //CLog::Print("CEntity_StaticMesh(%p)::CEntity_StaticMesh(), pOrigin=%p\n",this,(CLinkOrigin*)this); CalcBox(); }
void TextGraphic::getExtent ( float& x0, float& y0, float& cx, float& cy, float& tol, Graphic* gs ) { PSFont* f = gs->GetFont(); Coord l, b, r, t; CalcBox(l, b, r, t, f); if (gs->GetTransformer() == nil) { x0 = l; y0 = b; cx = float(l + r) / 2; cy = float(b + t) / 2; } else { transformRect(l, b, r, t, x0, y0, cx, cy, gs); cx = (cx + x0)/2; cy = (cy + y0)/2; } tol = 0; }
Tetra *FastMakeTetra(Face *f, Point3 *v, int n, UG *G) { Plane p; Tetra *t; float CellBoxRadius= 0.0, /* Radius of Cell Box to scan for dd-nearest */ BoxRadius, FaceRadius, MinRadius=BIGNUMBER; struct argGroup args; Line Lc; IntPoint3 vn,vp, start, end, inc; int Index=-1; boolean Found=FALSE; SI.MakeTetra++; UGResetMark(G); if(!CalcPlane(&(v[f->v[0]]),&(v[f->v[1]]),&(v[f->v[2]]),&p)) Error("Faccia composta da tre punti allineati!!\n",EXIT); CalcLineofCenter(&(v[f->v[0]]),&(v[f->v[1]]),&(v[f->v[2]]),&Lc); FaceRadius=V3DistanceBetween2Points(&(Lc.Lu), &(v[f->v[0]])); args.f = f; args.Lc = &Lc; args.p = &p; args.G = G; // printf("checkpoint 0\n"); do { CellBoxRadius++; BoxRadius=CalcBox(f,v,&Lc,G,&vn,&vp, CellBoxRadius*FaceRadius); Found=ScanCellBox(&vn, &vp, v,&args,&Index, &MinRadius); } while(!Found && CellBoxRadius <= 1); //printf("checkpoint 1\n"); // printf("MinRadius = %f BoxRadius = %f\n",MinRadius, BoxRadius); if(Found && MinRadius>BoxRadius) {float oldMinRadius=MinRadius; SI.SecondBox++; // printf("f->v[0] = %d, f->v[1] = %d, f->v[2] = %d, sqrt(MinRadius) = %f\n",f->v[0],f->v[1],f->v[2], sqrt(MinRadius)); BoxRadius=CalcBox(f,v,&Lc,G,&vn,&vp, sqrt(MinRadius)); // printf("checkpoint 2\n"); //printf("vn->x = %d ,vn->y = %d, vn->z = %d, vp->x = %d, vp->y = %d, vp->z = %d, radius = %f\n",vn.x, vn.y, vn.z, vp.x, vp.y,vp.z,MinRadius); ScanCellBox(&vn, &vp, v, &args, &Index, &MinRadius); //printf("checkpoint 2.1\n"); if(oldMinRadius>MinRadius) SI.UsefulSecondBox++; } if(!Found) { //printf("checkpoint 3\n"); SI.EmptyBox++; CalcLastScan(G, &start, &end, &inc, &p); //printf("checkpoint 4\n"); Found=MakeLastScan(&start, &end, &inc, v, &args, &Index,&MinRadius); } //printf("chekpoint 5\n"); if(!Found) return NULL; if(MinRadius>0) { SI.MinRadius+=sqrt(MinRadius); SI.MinRadiusNum++; } t=BuildTetra(f,Index); if(StatFlag) {Point3 C; CalcSphereCenter(&(v[f->v[0]]),&(v[f->v[1]]),&(v[f->v[2]]),&(v[Index]),&C); SI.Radius+=V3DistanceBetween2Points(&C, &(v[Index])); } if(CheckFlag) CheckTetra(t,v,n); return t; }