本文整理汇总了C++中Box3::Init方法的典型用法代码示例。如果您正苦于以下问题:C++ Box3::Init方法的具体用法?C++ Box3::Init怎么用?C++ Box3::Init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Box3
的用法示例。
在下文中一共展示了Box3::Init方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetWorldBoundBox
void TapeHelpObject::GetWorldBoundBox(TimeValue t, INode* inode, ViewExp* vpt, Box3& box )
{
if ( ! vpt || ! vpt->IsAlive() )
{
box.Init();
return;
}
int i, nv;
Matrix3 tm;
float dtarg;
Point3 pt;
Point3 q[2];
GetMat(t,inode,*vpt,tm);
nv = mesh.getNumVerts();
box.Init();
for (i=0; i<nv; i++)
box += tm*mesh.getVert(i);
if (GetTargetPoint(t,inode,pt)) {
tm = inode->GetObjectTM(t);
dtarg = Length(tm.GetTrans()-pt)/Length(tm.GetRow(2));
box += tm*Point3(float(0),float(0),-dtarg);
}
if(GetSpecLen()) {
GetLinePoints(t, q, GetLength(t) );
box += tm * q[0];
box += tm * q[1];
}
}
示例2: GetWorldBoundBox
void WindObject::GetWorldBoundBox(TimeValue t, INode* inode, ViewExp* vpt, Box3& box )
{
if ( ! vpt || ! vpt->IsAlive() )
{
box.Init();
return;
}
Box3 meshBox;
Matrix3 mat = inode->GetObjectTM(t);
box.Init();
int hoopson;
pblock2->GetValue(PB_HOOPSON,t,hoopson,FOREVER);
if (hoopson)
{ float decay; pblock2->GetValue(PB_DECAY,t,decay,FOREVER);
if (decay>0.0f)
{ float range,xy; range=2.0f*(decay > 0.0f?0.6931472f / decay:0.0f);
int type;pblock2->GetValue(PB_TYPE,t,type,ivalid);
if (type==FORCE_PLANAR)
{ pblock2->GetValue(PB_DISPLENGTH,t,xy,FOREVER);
xy*=3.0f;
}
else
xy=range;
Box3 rangeBox(Point3(-xy,-xy,-range),Point3(xy,xy,range));
for(int i = 0; i < 8; i++)
box += mat * rangeBox[i];
}
}
GetLocalBoundBox(t,inode,vpt,meshBox);
for(int i = 0; i < 8; i++)
box += mat * meshBox[i];
}
示例3: GetMirrorBone
int MorphByBone::GetMirrorBone(int id)
{
int whichBone = 0;
if (id == -1)
whichBone = currentBone;
else whichBone = id;
//make sure it is a valid node
if ((whichBone < 0) || (whichBone >= boneData.Count()) )
{
return -1;
}
if (GetNode(whichBone) == NULL) return -1;
Matrix3 itm = Inverse(localDataList[0]->selfObjectTM);
Point3 mirrorMin, mirrorMax;
Box3 mbox;
mbox.Init();
mbox += boneData[whichBone]->localBounds.pmin * boneData[whichBone]->currentBoneObjectTM * itm;
mbox += boneData[whichBone]->localBounds.pmax * boneData[whichBone]->currentBoneObjectTM * itm;
mirrorMin = mbox.pmin;
mirrorMax = mbox.pmax;
int closestBone = -1;
float closestDist = 0.0f;
for (int i = 0; i < boneData.Count(); i++)
{
INode *node = GetNode(i);
if (node)
{
Box3 box;
box.Init();
box += boneData[i]->localBounds.pmin * boneData[i]->currentBoneObjectTM * itm * mirrorTM;
box += boneData[i]->localBounds.pmax * boneData[i]->currentBoneObjectTM * itm * mirrorTM;
Point3 min, max;
min = box.pmin;// * boneData[i]->currentBoneObjectTM * itm * mirrorTM;
max = box.pmax;// * boneData[i]->currentBoneObjectTM * itm * mirrorTM;
float dist = Length(mirrorMin - min) + Length(mirrorMax - max);
if ((closestBone == -1) || (dist < closestDist))
{
closestBone = i;
closestDist = dist;
}
}
}
return closestBone;
}
示例4: GetLocalBoundBox
void BendManip::GetLocalBoundBox(TimeValue t, INode* inode, ViewExp* vp, Box3& box )
{
if ( ! vp || ! vp->IsAlive() )
{
box.Init();
return;
}
if(inode == NULL)
return;
ModContext* mc = FindModContext( inode, modifier );
if( mc==NULL )
return;
Interval valid;
if (!vp)
vp = GetCOREInterface()->GetActiveViewExp().ToPointer();
if ( ! vp || ! vp->IsAlive() )
{
box.Init();
return;
}
GraphicsWindow *gw = vp->getGW();
Matrix3 modmat, ntm = inode->GetObjTMBeforeWSM(t), off, invoff;
if (mc->box->IsEmpty()) {
return;
}
//Lets get the Modifier do all the work here
modmat = modifier->CompMatrix(t,*mc,ntm,valid,FALSE);
modifier->CompOffset(t,off,invoff);
BoxLineProc bp1(&modmat);
DoModifiedBox(*mc->box, modifier->GetDeformer(t,*mc,invoff,off), bp1);
box = bp1.Box();
box = *(mc->box);
Eval(t);
}
示例5: GetWorldBoundBox
//Get a bounding box. This is used for when we display the formation continously.
void FormationBhvr::GetWorldBoundBox(TimeValue t, ViewExp *vpt, Box3& box)
{
if ( ! vpt || ! vpt->IsAlive() )
{
box.Init();
return;
}
//make sure we have everything we need...
if(DisplayFormation(t)==FALSE) return;
if(GetFollowerCount(t)<=0) return;
if(GetFollowerMatrixCount(t)<=0) return; //possible to not have this set when the follower is set..
INode *leaderNode;
leaderNode = GetLeader(t);
if(leaderNode==NULL) return;
//for each follower we need to increase the bounding box by it's
//world position location...
for(int i =0;i<GetFollowerCount(t);i++)
{
if(GetFollower(t,i)) //if we have a a node...
{
Matrix3 worldSpace = GetFollowerMatrix(t,i)*GetCurrentMatrix(leaderNode,t);
Point3 trans(worldSpace.GetTrans());
//expand the box by the worldposition...
box += trans;
}
}
}
示例6: GetLocalBoundBox
void TapeHelpObject::GetLocalBoundBox(TimeValue t, INode* inode, ViewExp* vpt, Box3& box )
{
if ( ! vpt || ! vpt->IsAlive() )
{
box.Init();
return;
}
Matrix3 m = inode->GetObjectTM(t);
Point3 pt;
Point3 q[4];
float scaleFactor = vpt->NonScalingObjectSize()*vpt->GetVPWorldWidth(m.GetTrans())/(float)360.0;
box = mesh.getBoundingBox();
box.Scale(scaleFactor);
float d;
if (GetTargetPoint(t,inode,pt)) {
d = Length(m.GetTrans()-pt)/Length(inode->GetObjectTM(t).GetRow(2));
box += Point3(float(0),float(0),-d);
}
if(GetSpecLen()) {
GetLinePoints(t, q, GetLength(t) );
box += q[0];
box += q[1];
}
}
示例7: 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;
}
示例8: Bound
Box3 SceneEnumProc::Bound()
{
Box3 bound;
bound.Init();
MySceneEntry *e = head;
#if _3DSMAX_VERSION >= 2013
ViewExp &vpt = i->GetViewExp(NULL);
#else
ViewExp *vpt = i->GetViewport(NULL);
#endif
while(e)
{
Box3 bb;
#if _3DSMAX_VERSION >= 2013
e->obj->GetWorldBoundBox(time, e->node, &vpt, bb);
#else
e->obj->GetWorldBoundBox(time, e->node, vpt, bb);
#endif
bound += bb;
e = e->next;
}
return bound;
}
示例9: GetDeformBBox
void TriObject::GetDeformBBox(TimeValue t, Box3& box, Matrix3 *tm, BOOL useSel )
{
if ( tm || useSel ) {
box.Init();
BitArray sel;
BitArray vhide;
float *vssel = NULL;
if ( useSel ) {
sel = mesh.VertexTempSel();
vssel = mesh.getVSelectionWeights ();
} else {
vhide = mesh.vertHide;
if (vhide.NumberSet ()) {
for (int i=0; i<mesh.getNumFaces(); i++) {
if (mesh.faces[i].Hidden ()) continue;
for (int j=0; j<3; j++) vhide.Clear (mesh.faces[i].v[j]);
}
}
}
for ( int i = 0; i < mesh.getNumVerts(); i++ ) {
if (!useSel && vhide[i]) continue;
if ( !useSel || sel[i] || (vssel&&vssel[i])) {
if ( tm ) {
box += *tm * mesh.getVert(i);
} else {
box += mesh.getVert(i);
}
}
}
} else {
box = mesh.getBoundingBox();
}
}
示例10: GetWorldBoundBox
/*
void ParticleMesherObject::GetWorldBoundBox(TimeValue t, INode * inode, ViewExp* vp, Box3& box )
{
box.Init();
Matrix3 mat = inode->GetObjectTM(t);
Point3 a(-10.0f,-10.0f,-10.0f);
Point3 b(10.0f,10.0f,10.0f);
a = a * mat;
b = b * mat;
box+= a;
box+= b;
}
void ParticleMesherObject::GetLocalBoundBox(TimeValue t, INode* inode, ViewExp* vp, Box3& box )
{
box.Init();
Point3 a(-10.0f,-10.0f,-10.0f);
Point3 b(10.0f,10.0f,10.0f);
box+= a;
box+= b;
}
*/
void ParticleMesherObject::GetDeformBBox(TimeValue t, Box3& box, Matrix3 *tm, BOOL useSel )
{
BOOL useBounds;
pblock2->GetValue(particlemesher_usecustombounds, 0, useBounds, FOREVER);
if (useBounds)
{
box.Init();
Point3 a(-10.0f,-10.0f,-10.0f);
Point3 b(10.0f,10.0f,10.0f);
pblock2->GetValue(particlemesher_customboundsa, 0, a, FOREVER);
pblock2->GetValue(particlemesher_customboundsb, 0, b, FOREVER);
if (tm)
{
a = a * *tm;
b = b * *tm;
}
box+= a;
box+= b;
if (box.IsEmpty())
SimpleObject2::GetDeformBBox(t,box,tm,useSel);
}
else
{
SimpleObject2::GetDeformBBox(t,box,tm,useSel);
}
}
示例11: GetWorldBoundBox
void PointHelpObject::GetWorldBoundBox(
TimeValue t, INode* inode, ViewExp* vpt, Box3& box )
{
if ( ! vpt || ! vpt->IsAlive() )
{
box.Init();
return;
}
Matrix3 tm;
tm = inode->GetObjectTM(t);
Box3 lbox;
GetLocalBoundBox(t, inode, vpt, lbox);
box = Box3(tm.GetTrans(), tm.GetTrans());
for (int i=0; i<8; i++) {
box += lbox * tm;
}
/*
if(!(extDispFlags & EXT_DISP_ZOOM_EXT) && showAxis)
box = GetAxisBox(vpt,tm,showAxis?axisLength:0.0f, FALSE);
else
box = Box3(tm.GetTrans(), tm.GetTrans());
*/
}
示例12: EdgeIntersect
int UVW_ChannelClass::EdgeIntersect(Point3 p, float threshold, int i1,int i2)
{
static int startEdge = 0;
if (startEdge >= ePtrList.Count()) startEdge = 0;
if (ePtrList.Count() == 0) return -1;
int ct = 0;
BOOL done = FALSE;
int hitEdge = -1;
while (!done)
{
//check bounding volumes
Box3 bounds;
bounds.Init();
int index1 = ePtrList[startEdge]->a;
int index2 = ePtrList[startEdge]->b;
if (v[index1].IsHidden() && v[index2].IsHidden())
{
}
else if (v[index1].IsFrozen() && v[index1].IsFrozen())
{
}
else
{
Point3 p1(0.0f,0.0f,0.0f);
p1[i1] = v[index1].GetP()[i1];
p1[i2] = v[index1].GetP()[i2];
// p1.z = 0.0f;
bounds += p1;
Point3 p2(0.0f,0.0f,0.0f);
p2[i1] = v[index2].GetP()[i1];
p2[i2] = v[index2].GetP()[i2];
// p2.z = 0.0f;
bounds += p2;
bounds.EnlargeBy(threshold);
if (bounds.Contains(p))
{
//check edge distance
if (LineToPoint(p, p1, p2) < threshold)
{
hitEdge = startEdge;
done = TRUE;
// LineToPoint(p, p1, p2);
}
}
}
ct++;
startEdge++;
if (ct == ePtrList.Count()) done = TRUE;
if (startEdge >= ePtrList.Count()) startEdge = 0;
}
return hitEdge;
}
示例13: UpdateUI
void ParticleMesherObject::UpdateUI()
{
Point3 min,max;
pblock2->GetValue(particlemesher_customboundsa,0,min,FOREVER);
pblock2->GetValue(particlemesher_customboundsb,0,max,FOREVER);
Box3 box;
box.Init();
box += min;
box += max;
TSTR text;
BOOL useBounds;
pblock2->GetValue(particlemesher_usecustombounds, 0, useBounds, FOREVER);
if (useBounds)
{
if (box.IsEmpty())
text.printf(_T("%s"),GetString(IDS_EMPTY));
else
{
text.printf(_T("(%0.0f,%0.0f,%0.0f)"),min.x,min.y,min.z);
SetWindowText(GetDlgItem(hParams,IDC_BOUNDSTEXT),
text);
text.printf(_T("(%0.0f,%0.0f,%0.0f)"),max.x,max.y,max.z);
SetWindowText(GetDlgItem(hParams,IDC_BOUNDSTEXT2),
text);
}
//make sure we only enable the button in the modify panel
// bug 257747 1/30/01 watje
if (ip)
{
ICustButton *iBut = GetICustButton(GetDlgItem(hParams,IDC_PICKBB));
if (ip->GetCommandPanelTaskMode()==TASK_MODE_MODIFY)
{
if (iBut) iBut->Enable(TRUE);
}
ReleaseICustButton(iBut);
}
}
else
{
text.printf(_T(" "));
SetWindowText(GetDlgItem(hParams,IDC_BOUNDSTEXT),
text);
text.printf(_T(" "));
SetWindowText(GetDlgItem(hParams,IDC_BOUNDSTEXT2),
text);
ICustButton *iBut = GetICustButton(GetDlgItem(hParams,IDC_PICKBB));
if (iBut) iBut->Enable(FALSE);
ReleaseICustButton(iBut);
}
}
示例14: GetWorldBoundBox
void TargetObject::GetWorldBoundBox(TimeValue t, INode* inode, ViewExp* vpt, Box3& box )
{
if ( ! vpt || ! vpt->IsAlive() )
{
box.Init();
return;
}
int i,nv;
Matrix3 m;
GetMat(t,inode,*vpt,m);
nv = mesh.getNumVerts();
box.Init();
for (i=0; i<nv; i++)
box += m*mesh.getVert(i);
}
示例15: GetWorldBoundBox
void FExtrudeMod::GetWorldBoundBox (TimeValue t, INode* inode,
ViewExp * /*vpt*/, Box3& box, ModContext *mc) {
Matrix3 tm = CompMatrix(t,inode,mc);
Point3 pt;
box.Init();
mp_base->GetValue(t,&pt,FOREVER,CTRL_ABSOLUTE);
box += pt * tm;
}