本文整理汇总了C++中Box3::Min方法的典型用法代码示例。如果您正苦于以下问题:C++ Box3::Min方法的具体用法?C++ Box3::Min怎么用?C++ Box3::Min使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Box3
的用法示例。
在下文中一共展示了Box3::Min方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: IConformCheck
BOOL plDistributor::IConformCheck(Matrix3& l2w, int iRepNode, plMeshCacheTab& cache, int& iCache) const
{
Matrix3 OTM = IOTM(iRepNode);
Mesh* mesh = cache[iRepNode].fMesh;
Point3 dir = l2w.VectorTransform(Point3(0.f, 0.f, 1.f));
dir = FNormalize(dir);
const float kOneOverSqrt2 = 0.707107f;
Point3 scalePt(kOneOverSqrt2, kOneOverSqrt2, 0.f);
scalePt = l2w.VectorTransform(scalePt);
float maxScaledDist = fMaxConform * scalePt.Length();
Box3 bnd = mesh->getBoundingBox() * OTM;
bnd = Box3(Point3(bnd.Min().x, bnd.Min().y, -bnd.Max().z), bnd.Max());
bnd = bnd * l2w;
Tab<int32_t> faces;
IFindFaceSet(bnd, faces);
int i;
for( i = 0; i < mesh->getNumVerts(); i++ )
{
Point3 pt = mesh->getVert(i) * OTM;
pt.z = 0;
pt = pt * l2w;
Point3 projPt;
if( !IProjectVertex(pt, dir, maxScaledDist, faces, projPt) )
return false;
}
return true;
}
示例2: BuildColBox
void bhkProxyObject::BuildColBox()
{
Box3 box; box.Init();
for (int i = 0;i < pblock2->Count(PB_MESHLIST); i++) {
INode *tnode = NULL;
pblock2->GetValue(PB_MESHLIST,0,tnode,FOREVER,i);
if (tnode)
{
ObjectState os = tnode->EvalWorldState(0);
Matrix3 wm = tnode->GetNodeTM(0);
TriObject *tri = (TriObject *)os.obj->ConvertToType(0, Class_ID(TRIOBJ_CLASS_ID, 0));
if (tri)
{
Box3 box2; box2.Init();
Mesh& mesh = tri->GetMesh();
CalcAxisAlignedBox(mesh, box2, &wm);
box += box2;
}
}
}
BuildBox(proxyMesh, box.Max().y-box.Min().y, box.Max().x-box.Min().x, box.Max().z-box.Min().z);
MNMesh mn(proxyMesh);
Matrix3 tm(true);
tm.SetTranslate(box.Center());
mn.Transform(tm);
mn.OutToTri(proxyMesh);
//proxyPos = box.Center();
proxyPos = Point3::Origin;
forceRedraw = true;
}
示例3: IConformAll
BOOL plDistributor::IConformAll(Matrix3& l2w, int iRepNode, plMeshCacheTab& cache, int& iCache) const
{
Matrix3 OTM = IOTM(iRepNode);
Mesh* mesh = cache[iRepNode].fMesh;
Point3 dir = l2w.VectorTransform(Point3(0.f, 0.f, 1.f));
dir = FNormalize(dir);
const float kOneOverSqrt2 = 0.707107f;
Point3 scalePt(kOneOverSqrt2, kOneOverSqrt2, 0.f);
scalePt = l2w.VectorTransform(scalePt);
float maxScaledDist = fMaxConform * scalePt.Length();
Box3 bnd = mesh->getBoundingBox() * OTM;
bnd = Box3(Point3(bnd.Min().x, bnd.Min().y, -bnd.Max().z), bnd.Max());
bnd = bnd * l2w;
Tab<int32_t> faces;
IFindFaceSet(bnd, faces);
// l2w, iRepNode, cache, &iCache, maxScaledDist, dir
iCache = cache.Count();
cache.SetCount(iCache + 1);
cache[iCache] = cache[iRepNode];
cache[iCache].fMesh = new Mesh(*mesh);
mesh = cache[iCache].fMesh;
Matrix3 v2w = OTM * l2w;
Matrix3 w2v = Inverse(v2w);
BOOL retVal = true;
int i;
for( i = 0; i < mesh->getNumVerts(); i++ )
{
Point3 pt = mesh->getVert(i) * OTM;
pt.z = 0;
pt = pt * l2w;
Point3 projPt;
if( !IProjectVertex(pt, dir, maxScaledDist, faces, projPt) )
{
retVal = false;
break;
}
Point3 del = w2v.VectorTransform(projPt - pt);
mesh->getVert(i) += del;
}
if( !retVal )
{
// delete cache[iCache].fMesh;
delete mesh;
cache.SetCount(iCache);
iCache = iRepNode;
}
return retVal;
}
示例4: isPointInBoxBias
/// positive in, negative out
static inline bool isPointInBoxBias(const Box3& box, const double3& point)
{
if (point.x > box.Max().x) return false;
if (point.y > box.Max().y) return false;
if (point.z > box.Max().z) return false;
if (point.x <= box.Min().x) return false;
if (point.y <= box.Min().y) return false;
if (point.z <= box.Min().z) return false;
return true;
}
示例5: BuildColBox
void bhkRigidBodyModifier::BuildColBox(Mesh& mesh)
{
Box3 box; box.Init();
CalcAxisAlignedBox(mesh, box, NULL);
BuildBox(mesh, box.Max().y-box.Min().y, box.Max().x-box.Min().x, box.Max().z-box.Min().z);
MNMesh mn(mesh);
Matrix3 tm(true);
tm.Translate(box.Center());
mn.Transform(tm);
mn.OutToTri(mesh);
}
示例6: MakePatchCapTexture
static void MakePatchCapTexture(PatchMesh &pmesh, Matrix3 &itm, int pstart, int pend, BOOL usePhysUVs) {
if(pstart == pend)
return;
// Find out which verts are used by the cap
BitArray capVerts(pmesh.numVerts);
capVerts.ClearAll();
for(int i = pstart; i < pend; ++i) {
Patch &p = pmesh.patches[i];
capVerts.Set(p.v[0]);
capVerts.Set(p.v[1]);
capVerts.Set(p.v[2]);
if(p.type == PATCH_QUAD)
capVerts.Set(p.v[3]);
}
// Minmax the verts involved in X/Y axis and total them
Box3 bounds;
int numCapVerts = 0;
int numCapPatches = pend - pstart;
IntTab capIndexes;
capIndexes.SetCount(pmesh.numVerts);
int baseTVert = pmesh.getNumTVerts();
for(int i = 0; i < pmesh.numVerts; ++i) {
if(capVerts[i]) {
capIndexes[i] = baseTVert + numCapVerts++;
bounds += pmesh.verts[i].p * itm;
}
}
pmesh.setNumTVerts(baseTVert + numCapVerts, TRUE);
Point3 s;
if (usePhysUVs)
s = Point3(1.0f, 1.0f, 0.0f);
else
s = Point3(1.0f / bounds.Width().x, 1.0f / bounds.Width().y, 0.0f);
Point3 t(-bounds.Min().x, -bounds.Min().y, 0.0f);
// Do the TVerts
for(int i = 0; i < pmesh.numVerts; ++i) {
if(capVerts[i])
pmesh.setTVert(baseTVert++, ((pmesh.verts[i].p * itm) + t) * s);
}
// Do the TVPatches
for(int i = pstart; i < pend; ++i) {
Patch &p = pmesh.patches[i];
TVPatch &tp = pmesh.getTVPatch(i);
if(p.type == PATCH_TRI)
tp.setTVerts(capIndexes[p.v[0]], capIndexes[p.v[1]], capIndexes[p.v[2]]);
else
tp.setTVerts(capIndexes[p.v[0]], capIndexes[p.v[1]], capIndexes[p.v[2]], capIndexes[p.v[3]]);
}
}
示例7: IConvertAngleAttenLayer
plLayerInterface* plLayerConverter::IConvertAngleAttenLayer(plPlasmaMAXLayer *layer,
plMaxNode *maxNode, uint32_t blendFlags,
bool preserveUVOffset, bool upperLayer)
{
hsGuardBegin( "plPlasmaMAXLayer::IConvertAngleAttenLayer" );
if( !upperLayer )
{
fErrorMsg->Set(true, maxNode->GetName(), "Angle Attenuation layers can only be used as a top layer").Show();
fErrorMsg->Set();
return nil;
}
plAngleAttenLayer* aaLay = (plAngleAttenLayer*)layer;
Box3 fade = aaLay->GetFade();
float tr0 = cosf(DegToRad(180.f - fade.Min().x));
float op0 = cosf(DegToRad(180.f - fade.Min().y));
float tr1 = cosf(DegToRad(180.f - fade.Max().x));
float op1 = cosf(DegToRad(180.f - fade.Max().y));
int loClamp = aaLay->GetLoClamp();
int hiClamp = aaLay->GetHiClamp();
int uvwSrc = aaLay->Reflect() ? plLayerInterface::kUVWReflect : plLayerInterface::kUVWNormal;
plLayer* lut = ICreateAttenuationLayer(plString::FromUtf8(layer->GetName()), maxNode, uvwSrc, tr0, op0, tr1, op1, loClamp, hiClamp);
return lut;
hsGuardEnd;
}
示例8: MakeDummyMesh
static void MakeDummyMesh(plMaxNode* node, plMaxMeshExtractor::NeutralMesh& mesh)
{
hsPoint3 minV, maxV;
Object* thisObj = node->GetObjectRef();
DummyObject* thisDummy = (DummyObject*)thisObj;
Box3 thisBoundSurface = thisDummy->GetBox();
minV.fX = thisBoundSurface.Min().x;
minV.fY = thisBoundSurface.Min().y;
minV.fZ = thisBoundSurface.Min().z;
maxV.fX = thisBoundSurface.Max().x;
maxV.fY = thisBoundSurface.Max().y;
maxV.fZ = thisBoundSurface.Max().z;
MakeBoxMesh(node, mesh, minV, maxV);
}
示例9:
static inline void normalizeBox3(const Box3& target, const Box3& env, Box3& output)
{
auto scale = env.Diagonal();
auto center = env.Center();
output.Set((target.Min()-center)/scale*2.0,
(target.Max()-center)/scale*2.0);
}
示例10: MakeMeshCapTexture
static void MakeMeshCapTexture(Mesh &mesh, Matrix3 &itm, int fstart, int fend, BOOL usePhysUVs) {
if(fstart == fend)
return;
// Find out which verts are used by the cap
BitArray capVerts(mesh.numVerts);
capVerts.ClearAll();
for(int i = fstart; i < fend; ++i) {
Face &f = mesh.faces[i];
capVerts.Set(f.v[0]);
capVerts.Set(f.v[1]);
capVerts.Set(f.v[2]);
}
// Minmax the verts involved in X/Y axis and total them
Box3 bounds;
int numCapVerts = 0;
int numCapFaces = fend - fstart;
IntTab capIndexes;
capIndexes.SetCount(mesh.numVerts);
int baseTVert = mesh.getNumTVerts();
for(int i = 0; i < mesh.numVerts; ++i) {
if(capVerts[i]) {
capIndexes[i] = baseTVert + numCapVerts++;
bounds += mesh.verts[i] * itm;
}
}
mesh.setNumTVerts(baseTVert + numCapVerts, TRUE);
Point3 s;
if (usePhysUVs)
s = Point3(1.0f, 1.0f, 0.0f);
else
s = Point3(1.0f / bounds.Width().x, 1.0f / bounds.Width().y, 0.0f);
Point3 t(-bounds.Min().x, -bounds.Min().y, 0.0f);
// Do the TVerts
for(int i = 0; i < mesh.numVerts; ++i) {
if(capVerts[i])
mesh.setTVert(baseTVert++, ((mesh.verts[i] * itm) + t) * s);
}
// Do the TVFaces
for(int i = fstart; i < fend; ++i) {
Face &f = mesh.faces[i];
mesh.tvFace[i] = TVFace(capIndexes[f.v[0]], capIndexes[f.v[1]], capIndexes[f.v[2]]);
}
}
示例11: minimum
static inline void staticFilter(Box3& box, double factor)
{
double3 minimum(box.Min());
double3 maximum(box.Max());
minimum.x = staticFilter(minimum.x, factor);
minimum.y = staticFilter(minimum.y, factor);
minimum.z = staticFilter(minimum.z, factor);
maximum.x = staticFilter(maximum.x, factor);
maximum.y = staticFilter(maximum.y, factor);
maximum.z = staticFilter(maximum.z, factor);
}
示例12: CalcBoundingBox
void Exporter::CalcBoundingBox(INode *node, Box3& box, int all)
{
if (nullptr == node)
return;
Matrix3 tm = node->GetObjTMAfterWSM(0);
if (node->IsBoneShowing()) {
box.IncludePoints(const_cast<Point3*>(&tm.GetTrans()), 1, nullptr);
}
else {
if (Object *o = node->GetObjectRef()) {
if (o->SuperClassID() == GEOMOBJECT_CLASS_ID) {
if (o->ClassID() == BONE_OBJ_CLASSID
|| o->ClassID() == Class_ID(BONE_CLASS_ID, 0)
|| o->ClassID() == Class_ID(0x00009125, 0) /* Biped Twist Helpers */
)
{
box.IncludePoints(const_cast<Point3*>(&tm.GetTrans()), 1, nullptr);
}
else
{
Box3 local;
#if VERSION_3DSMAX < (15000<<16) // Version 15 (2013)
o->GetLocalBoundBox(0, node, mI->GetActiveViewport(), local);
#else
o->GetLocalBoundBox(0, node, &mI->GetActiveViewExp(), local);
#endif
box.IncludePoints(&local.Min(), 1, nullptr);
box.IncludePoints(&local.Max(), 1, nullptr);
}
}
else if (mExportCameras && o->SuperClassID() == CAMERA_CLASS_ID)
{
box.IncludePoints(const_cast<Point3*>(&tm.GetTrans()), 1, nullptr);
}
}
}
if (all < 0)
return;
all = (all>0 ? all : -1);
for (int i = 0; i < node->NumberOfChildren(); i++) {
CalcBoundingBox(node->GetChildNode(i), box, all);
}
}
示例13: SplitSpaceByXYZ
void BSPOctree::SplitSpaceByXYZ(const Box3& bbox, Box3 childBoxes[])
{
vec3<float> minOffset, maxOffset;
const double factor = pow(2.0, 11);
double3 step = double3(
staticFilter(bbox.Diagonal().x* 0.5, factor)
, staticFilter(bbox.Diagonal().y*0.5, factor)
, staticFilter(bbox.Diagonal().z*0.5, factor));
for (int i = 0; i < 8 ; i++)
{
maxOffset.z = i & 1 ? 0 : -step.z;
maxOffset.y = i & 2 ? 0 : -step.y;
maxOffset.x = i & 4 ? 0 : -step.x;
minOffset.z = i & 1 ? step.z : 0;
minOffset.y = i & 2 ? step.y : 0;
minOffset.x = i & 4 ? step.x : 0;
childBoxes[i].Set(bbox.Min() + minOffset, bbox.Max()+ maxOffset);
}
}
示例14: IValidateFade
BOOL plDistribComponent_old::IValidateFade(Box3& fade)
{
BOOL retVal = true;
fade = GetFade();
if( fCompPB->GetInt(kFadeInActive) )
{
if( fade.Max()[0] < fade.Max()[1] )
{
if( fade.Min()[0] > fade.Max()[0] )
{
fade.pmin[0] = fade.Max()[0];
retVal = false;
}
if( fade.Min()[1] > fade.Min()[0] )
{
fade.pmin[1] = fade.Min()[0];
retVal = false;
}
}
else if( fade.Max()[0] > fade.Max()[1] )
{
if( fade.Min()[1] > fade.Max()[1] )
{
fade.pmin[1] = fade.Max()[1];
retVal = false;
}
if( fade.Min()[0] > fade.Min()[1] )
{
fade.pmin[0] = fade.Min()[1];
retVal = false;
}
}
}
return retVal;
}
示例15: DoExport
int Blockporter::DoExport(const TCHAR* name, ExpInterface* ei, Interface* i, BOOL supressPrompts, DWORD options)
{
INode* root;
//caption and message for MessagesBoxes
TCHAR msg[MB_BUFFER_LENGTH];
TCHAR cap[MB_BUFFER_LENGTH];
//Get the root node
root = i->GetRootNode();
//the node of our object should be a groupnode, which contains every object
//we want to export
i->PushPrompt(_T("Searching for Group..."));
bool found = false;
for(int idx = 0; idx < root->NumberOfChildren(); idx++)
{
if(root->GetChildNode(idx)->IsGroupHead())
{
//we found our group
//next step is to make the group node our new root, because every object
//we want is part of this group
found = true;
root = root->GetChildNode(idx);
break;
}
}
if(!found)
{
MessageBox(nullptr, GetString(IDS_ERROR_NO_GROUP, msg), GetString(IDS_GENERAL_ERROR, cap), MB_OK | MB_ICONERROR);
return 0;
}
//Now that we have the groupnode let's compare the fileversions
if(!IsNewModelVersion(name, root->GetName()))
{
if(MessageBox(nullptr, GetString(IDS_VER_TO_LOW_MSG, msg), GetString(IDS_VER_TO_LOW_CAP, cap), MB_YESNO | MB_ICONEXCLAMATION) == IDNO)
return 1;
}
i->PushPrompt(_T("Opening File"));
Interface14* iface = GetCOREInterface14();
UINT code = iface->DefaultTextSaveCodePage(true);
MaxSDK::Util::Path storageNamePath(name);
storageNamePath.SaveBaseFile();
switch (code & MaxSDK::Util::MaxStringDataEncoding::MSDE_CP_MASK)
{
case CP_UTF8:
mStream = _tfopen(name, _T("wt, ccs=UFT-8"));
break;
case MaxSDK::Util::MaxStringDataEncoding::MSDE_CP_UTF16:
mStream = _tfopen(name, _T("wt, ccs=UTF-16BE"));
break;
default:
mStream = _tfopen(name, _T("wt"));
}
if(!mStream)
return 0;
//now we have our file stream, so let's write the header
i->PushPrompt(_T("Writing Header"));
WriteHeader(root->GetName(), root->NumberOfChildren());
//now that we have the header written, let's iterate through the objects in the
//group and export the meshes and lights
INode* child;
Point3 pMin(0,0,0), pMax(0,0,0);
for(int idx = 0; idx < root->NumberOfChildren(); idx++)
{
child = root->GetChildNode(idx);
i->PushPrompt(_T("Processing Object %s", child->GetName()));
if(child->IsGroupHead())
{
MessageBox(nullptr, GetString(IDS_ERROR_TO_MANY_GROUPS, msg), GetString(IDS_GENERAL_ERROR, cap), MB_OK | MB_ICONERROR);
continue;
}
ObjectState os = child->EvalWorldState(0);
//let's take a look at the SuperClassID of the object
//so we find out if it's a mesh or a light
if(!os.obj)
continue; //somehow this node doesn't have an object
Box3 boundBox;
switch(os.obj->SuperClassID())
{
case GEOMOBJECT_CLASS_ID:
_ftprintf(mStream, _T("<ObjectID=%i>\n"), idx);
i->PushPrompt(_T("Writing MeshData for Object %s", child->GetName()));
boundBox = WriteMeshData(child, idx);
pMin.x = (boundBox.Min().x < pMin.x) ? boundBox.Min().x : pMin.x;
pMin.y = (boundBox.Min().y < pMin.y) ? boundBox.Min().y : pMin.y;
pMax.x = (boundBox.Max().x > pMax.x) ? boundBox.Max().x : pMax.x;
pMax.y = (boundBox.Max().y > pMax.y) ? boundBox.Max().y : pMax.y;
i->PushPrompt(_T("Writing MaterialData for Object %s", child->GetName()));
//.........这里部分代码省略.........