本文整理汇总了C++中BitArray::ClearAll方法的典型用法代码示例。如果您正苦于以下问题:C++ BitArray::ClearAll方法的具体用法?C++ BitArray::ClearAll怎么用?C++ BitArray::ClearAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BitArray
的用法示例。
在下文中一共展示了BitArray::ClearAll方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void UnwrapMod::BuildUsedList(BitArray &usedVerts, ClusterClass *cluster)
{
usedVerts.SetSize(TVMaps.v.Count());
usedVerts.ClearAll();
for (int j =0; j < cluster->faces.Count(); j++)
{
int faceIndex = cluster->faces[j];
for (int k = 0; k < TVMaps.f[faceIndex]->count; k++)
{
//need to put patch handles in here also
int index = TVMaps.f[faceIndex]->t[k];
usedVerts.Set(index);
if ((TVMaps.f[faceIndex]->flags & FLAG_CURVEDMAPPING) && (TVMaps.f[faceIndex]->vecs))
{
index = TVMaps.f[faceIndex]->vecs->handles[k*2];
if ((index >= 0) && (index < usedVerts.GetSize()))
usedVerts.Set(index);
index = TVMaps.f[faceIndex]->vecs->handles[k*2+1];
if ((index >= 0) && (index < usedVerts.GetSize()))
usedVerts.Set(index);
if (TVMaps.f[faceIndex]->flags & FLAG_INTERIOR)
{
index = TVMaps.f[faceIndex]->vecs->interiors[k];
if ((index >= 0) && (index < usedVerts.GetSize()))
usedVerts.Set(index);
}
}
}
}
}
示例2: ModifyTriObject
void EChamferMod::ModifyTriObject (TimeValue t, ModContext &mc, TriObject *tobj) {
Mesh &mesh = tobj->GetMesh();
Interval iv = FOREVER;
float amount;
int i, j;
m_pblock->GetValue (kEchAmount, t, amount, iv);
// Convert existing selection (at whatever level) to edge selection:
BitArray targetEdges;
targetEdges.SetSize (mesh.numFaces*3);
targetEdges.ClearAll ();
switch (mesh.selLevel) {
case MESH_OBJECT:
targetEdges.SetAll ();
break;
case MESH_VERTEX:
for (i=0; i<mesh.numFaces; i++) {
for (j=0; j<3; j++) {
if (!mesh.vertSel[mesh.faces[i].v[j]]) continue;
// Don't select invisible edges:
if (mesh.faces[i].getEdgeVis(j)) targetEdges.Set (i*3+j);
if (mesh.faces[i].getEdgeVis((j+2)%3)) targetEdges.Set (i*3+(j+2)%3);
}
}
break;
case MESH_EDGE:
targetEdges = mesh.edgeSel;
break;
case MESH_FACE:
for (i=0; i<mesh.numFaces; i++) {
if (!mesh.faceSel[i]) continue;
for (j=0; j<3; j++) {
// Don't select invisible edges:
if (mesh.faces[i].getEdgeVis(j)) targetEdges.Set (i*3+j);
}
}
break;
}
// Chamfer the edges -- this just does the topological operation.
MeshDelta tmd;
tmd.InitToMesh (mesh);
MeshTempData temp;
temp.SetMesh (&mesh);
MeshChamferData *mcd = temp.ChamferData();
AdjEdgeList *ae = temp.AdjEList();
tmd.ChamferEdges (mesh, targetEdges, *mcd, ae);
tmd.Apply (mesh);
// Reset the meshdelta, temp data to deal with the post-chamfered topology:
tmd.InitToMesh (mesh);
temp.Invalidate (TOPO_CHANNEL); // Generates a new edge list, but preserves chamfer data
temp.SetMesh (&mesh);
tmd.ChamferMove (mesh, *temp.ChamferData(), amount, temp.AdjEList());
tmd.Apply (mesh);
tobj->UpdateValidity(GEOM_CHAN_NUM,iv);
}
示例3: DeleteFaces
void XTCSample::DeleteFaces(TimeValue t,Object *obj)
{
if(bNF_OnOff)
{
Mesh *mesh = GetMesh(obj);
if(!mesh)
return;
Interval ivalid = FOREVER;
int nf;
bo->GetParamBlockByID(x_params)->GetValue(pb_nf_spin,t,nf, ivalid);
BitArray ba;
ba.SetSize(mesh->getNumFaces());
ba.ClearAll();
for(int i = nf ; i < mesh->getNumFaces() ; i++ )
{
ba.Set(i);
}
if(!ba.IsEmpty())
mesh->DeleteFaceSet(ba);
}
}
示例4: ConvertTriSelection
void VWeldMod::ConvertTriSelection (Mesh & mesh, BitArray & targetVerts) {
targetVerts.SetSize (mesh.numVerts);
targetVerts.ClearAll ();
int i, j;
switch (mesh.selLevel) {
case MESH_OBJECT:
targetVerts.SetAll ();
break;
case MESH_VERTEX:
targetVerts = mesh.vertSel;
break;
case MESH_EDGE:
for (i=0; i<mesh.numFaces; i++) {
for (j=0; j<3; j++) {
if (!mesh.edgeSel[i*3+j]) continue;
targetVerts.Set (mesh.faces[i].v[j]);
targetVerts.Set (mesh.faces[i].v[(j+1)%3]);
}
}
break;
case MESH_FACE:
for (i=0; i<mesh.numFaces; i++) {
if (!mesh.faceSel[i]) continue;
for (j=0; j<3; j++) targetVerts.Set (mesh.faces[i].v[j]);
}
break;
}
}
示例5: LengthSquared
void
UniformGrid::ClosestPoint(Point3 p, float radius, int &pindex, float &d)
{
xHitList.ClearAll();
yHitList.ClearAll();
zHitList.ClearAll();
hitList.SetCount(0);
//find the cell in the XGrid
TagCells(p,radius, 0);
//find the cell in the YGrid
TagCells(p,radius, 1);
//find the cell in the ZGrid
TagCells(p,radius, 2);
BitArray usedList;
usedList.SetSize(pointBase.Count());
usedList.ClearAll();
int closest = -1;
d = 0.0f;
Box3 localBounds;
localBounds.Init();
localBounds += p;
localBounds.EnlargeBy(radius);
for (int i = 0; i < hitList.Count(); i++)
{
int index = hitList[i];
if (!usedList[index]) //check to see if we have processed this one or not
{
if (xHitList[index] && yHitList[index] && zHitList[index])
{
usedList.Set(index);
Point3 source = pointBase[index];
if (localBounds.Contains(source))
{
float dist = LengthSquared(source-p);
if ((dist < d) || (closest == -1))
{
d = dist;
closest = index;
}
}
}
}
}
pindex = closest;
d = sqrt(d);
}
示例6: WeldTriObject
void SymmetryMod::WeldTriObject (Mesh & mesh, Point3 & N, float offset, float threshold) {
// Find vertices in target zone of mirror plane:
BitArray targetVerts;
targetVerts.SetSize (mesh.numVerts, true);
targetVerts.ClearAll ();
for (int i=0; i<mesh.numVerts; i++) {
float dist = DotProd (N, mesh.verts[i]) - offset;
if (fabsf(dist) > threshold) continue;
targetVerts.Set (i);
}
// Weld the suitable border vertices:
MeshDelta tmd(mesh);
BOOL found = tmd.WeldByThreshold (mesh, targetVerts, threshold);
tmd.Apply (mesh);
}
示例7:
void
UniformGrid::InRadius(Point3 p, Tab<int> &indexList)
{
float radius = largestRadius;
xHitList.ClearAll();
yHitList.ClearAll();
zHitList.ClearAll();
hitList.SetCount(0);
//find the cell in the XGrid
TagCells(p,radius, 0);
//find the cell in the YGrid
TagCells(p,radius, 1);
//find the cell in the ZGrid
TagCells(p,radius, 2);
BitArray usedList;
usedList.SetSize(pointBase.Count());
usedList.ClearAll();
int closest = -1;
float d = 0.0f;
Box3 localBounds;
localBounds.Init();
localBounds += p;
localBounds.EnlargeBy(radius);
for (int i = 0; i < hitList.Count(); i++)
{
int index = hitList[i];
if (!usedList[index]) //check to see if we have processed this one or not
{
if (xHitList[index] && yHitList[index] && zHitList[index])
{
usedList.Set(index);
Point3 source = pointBase[index];
if (localBounds.Contains(source))
{
indexList.Append(1,&index,1000);
}
}
}
}
}
示例8: MarkDeadVertices
void UVW_ChannelClass::MarkDeadVertices()
{
BitArray usedVerts;
usedVerts.SetSize(v.Count());
usedVerts.ClearAll();
for (int i =0; i < f.Count(); i++)
{
if (!(f[i]->flags & FLAG_DEAD))
{
for (int j=0; j < f[i]->count; j++)
{
int id = f[i]->t[j];
if (id < usedVerts.GetSize()) usedVerts.Set(id);
if ((f[i]->flags & FLAG_CURVEDMAPPING) && (f[i]->vecs))
{
id = f[i]->vecs->handles[j*2];
if (id < usedVerts.GetSize()) usedVerts.Set(id);
id = f[i]->vecs->handles[j*2+1];
if (id < usedVerts.GetSize()) usedVerts.Set(id);
if (f[i]->flags & FLAG_INTERIOR)
{
id = f[i]->vecs->interiors[j];
if (id < usedVerts.GetSize()) usedVerts.Set(id);
}
}
}
}
}
for (int i =0; i < v.Count(); i++)
{
if (i < usedVerts.GetSize())
{
BOOL isRigPoint = v[i].GetFlag() & FLAG_RIGPOINT;
if (!usedVerts[i] && (!isRigPoint))
{
v[i].SetDead();
}
}
}
}
示例9: Proceed
//+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+
//| From IPFTest |
//+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+
bool PFTestSplitBySource::Proceed(IObject* pCont,
PreciseTimeValue timeStart,
PreciseTimeValue& timeEnd,
Object* pSystem,
INode* pNode,
INode* actionNode,
IPFIntegrator* integrator,
BitArray& testResult,
Tab<float>& testTime)
{
if (pNode == NULL) return false;
bool exactStep = IsExactIntegrationStep(timeEnd, pSystem);
int conditionType = pblock()->GetInt(kSplitBySource_conditionType, timeStart);
// acquire absolutely necessary particle channels
IParticleChannelAmountR* chAmount = GetParticleChannelAmountRInterface(pCont);
if (chAmount == NULL) return false; // can't find number of particles in the container
int count = chAmount->Count();
bool isSelectedSource = false;
int i, systemHandle = pNode->GetHandle();
for(i=0; i<pblock()->Count(kSplitBySource_sources); i++) {
if (systemHandle == pblock()->GetInt(kSplitBySource_sources, 0, i)) {
isSelectedSource = true; break;
}
}
// test all particles
testResult.SetSize(count);
testResult.ClearAll();
testTime.SetCount(count);
if (exactStep) {
if ((isSelectedSource && (conditionType == kSplitBySource_conditionType_selected))
|| (!isSelectedSource && (conditionType == kSplitBySource_conditionType_notSelected))) {
testResult.SetAll();
for(i=0; i<count; i++) testTime[i] = 0.0f;
}
}
return true;
}
示例10: Proceed
//+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+
//| From IPFTest |
//+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+
bool PFTestGoToNextEvent::Proceed(IObject* pCont,
PreciseTimeValue timeStart,
PreciseTimeValue& timeEnd,
Object* pSystem,
INode* pNode,
INode* actionNode,
IPFIntegrator* integrator,
BitArray& testResult,
Tab<float>& testTime)
{
int conditionType = pblock()->GetInt(kGoToNextEvent_conditionType, timeStart);
bool exactStep = IsExactIntegrationStep(timeEnd, pSystem);
// get channel container interface
IChannelContainer* chCont;
chCont = GetChannelContainerInterface(pCont);
if (chCont == NULL) return false;
// acquire absolutely necessary particle channels
IParticleChannelAmountR* chAmount = GetParticleChannelAmountRInterface(pCont);
if (chAmount == NULL) return false; // can't find number of particles in the container
IParticleChannelPTVR* chTime = GetParticleChannelTimeRInterface(pCont);
if (chTime == NULL) return false; // can't read timing info for a particle
int count = chAmount->Count();
if (count <= 0) return true;
testResult.SetSize(count);
testTime.SetCount(count);
if((conditionType == kGoToNextEvent_conditionType_all) && exactStep) {
testResult.SetAll();
for(int i=0; i<count; i++) testTime[i] = 0.0f;
} else {
testResult.ClearAll();
}
return true;
}
示例11: Proceed
//+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+
//| From IPFTest |
//+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+
bool PFTestSplitSelected::Proceed(IObject* pCont,
PreciseTimeValue timeStart,
PreciseTimeValue& timeEnd,
Object* pSystem,
INode* pNode,
INode* actionNode,
IPFIntegrator* integrator,
BitArray& testResult,
Tab<float>& testTime)
{
bool exactStep = IsExactIntegrationStep(timeEnd, pSystem);
int conditionType = pblock()->GetInt(kSplitSelected_conditionType, timeStart);
// acquire absolutely necessary particle channels
IParticleChannelAmountR* chAmount = GetParticleChannelAmountRInterface(pCont);
if (chAmount == NULL) return false; // can't find number of particles in the container
int count = chAmount->Count();
IParticleChannelPTVR* chTime = GetParticleChannelTimeRInterface(pCont);
if (chTime == NULL) return false; // can't read timing info for a particle
IParticleChannelBoolR* chSelect = GetParticleChannelSelectionRInterface(pCont);
// test all particles
testResult.SetSize(count);
testResult.ClearAll();
testTime.SetCount(count);
for(int i=0; i<count; i++)
{
bool selected = (chSelect != NULL) ? chSelect->GetValue(i) : false;
bool sendOut = ((selected && (conditionType == kSplitSelected_conditionType_selected))
|| (!selected && (conditionType == kSplitSelected_conditionType_notSelected)));
if (sendOut && exactStep) {
testResult.Set(i);
testTime[i] = 0.0f;
}
}
return true;
}
示例12: SliceTriObject
void SymmetryMod::SliceTriObject (Mesh & mesh, Point3 & N, float offset) {
// Steve Anderson 9/14/2002
// Using the new "MESH_TEMP_1" flag to override Slice selection behavior,
// which is undesirable here.
mesh.SetFlag (MESH_TEMP_1);
MeshDelta slicemd;
slicemd.Slice (mesh, N, offset, false, true);
slicemd.Apply (mesh);
mesh.ClearFlag (MESH_TEMP_1);
// We need to strip out faces on the mirror plane itself.
// (These aren't always removed by slice.)
// Mark vertices at the plane boundary:
BitArray targetVerts;
targetVerts.SetSize (mesh.numVerts);
targetVerts.ClearAll ();
for (int i=0; i<mesh.numVerts; i++) {
float dist = DotProd (N, mesh.verts[i]) - offset;
if (fabsf(dist) > MNEPS) continue;
targetVerts.Set (i);
}
BitArray delFaces, delVerts;
delFaces.SetSize (mesh.numFaces);
for (int i=0; i<mesh.numFaces; i++) {
int j;
for (j=0; j<3; j++) {
if (!targetVerts[mesh.faces[i].v[j]]) break;
}
if (j<3) continue;
// Face needs to be deleted.
delFaces.Set (i);
}
mesh.DeleteFaceSet (delFaces, &delVerts);
mesh.DeleteVertSet (delVerts);
}
示例13:
void MeshTopoData::UpdateClusterVertices(Tab<ClusterClass*> &clusterList)
{
BitArray processedVerts;
processedVerts.SetSize(TVMaps.v.Count());
for (int i = 0; i < clusterList.Count(); i++)
{
if (clusterList[i]->ld == this)
{
clusterList[i]->verts.SetCount(0);
processedVerts.ClearAll();
for (int j = 0; j < clusterList[i]->faces.Count(); j++)
{
int findex = clusterList[i]->faces[j];
AddVertsToCluster(findex, processedVerts, clusterList[i]);
}
for (int j = 0; j < clusterList[i]->verts.Count(); j++)
{
int id = clusterList[i]->verts[j];
}
}
}
}
示例14: EdgeListFromPoints
//pelt
void UVW_ChannelClass::EdgeListFromPoints(Tab<int> &selEdges, int source, int target, Point3 vec)
{
//make sure point a and b are on the same element if not bail
Tab<VConnections*> ourConnects;
BOOL del = FALSE;
BitArray selVerts;
selVerts.SetSize(geomPoints.Count());
selVerts.ClearAll();
// if (TRUE)
//loop through the edges
Tab<int> numberOfConnections;
numberOfConnections.SetCount(geomPoints.Count());
for (int i = 0; i < geomPoints.Count(); i++)
{
numberOfConnections[i] = 0;
}
//count the number of vertxs connected
for (int i = 0; i < gePtrList.Count(); i++)
{
if (!(gePtrList[i]->flags & FLAG_HIDDENEDGEA))
{
int a = gePtrList[i]->a;
numberOfConnections[a] +=1;
int b = gePtrList[i]->b;
numberOfConnections[b] +=1;
}
}
//allocate our connections now
ourConnects.SetCount(geomPoints.Count());
for (int i = 0; i < geomPoints.Count(); i++)
{
ourConnects[i] = new VConnections();
ourConnects[i]->closestNode = NULL;
ourConnects[i]->linkedListChild = NULL;
ourConnects[i]->linkedListParent = NULL;
ourConnects[i]->accumDist = 1.0e+9f;
ourConnects[i]->solved = FALSE;
ourConnects[i]->vid = i;
ourConnects[i]->connectingVerts.SetCount(numberOfConnections[i]);
}
for (int i = 0; i < geomPoints.Count(); i++)
{
numberOfConnections[i] = 0;
}
//build our vconnection data
for (int i = 0; i < gePtrList.Count(); i++)
{
if (!(gePtrList[i]->flags & FLAG_HIDDENEDGEA))
{
int a = gePtrList[i]->a;
int b = gePtrList[i]->b;
int index = numberOfConnections[a];
ourConnects[a]->connectingVerts[index].vertexIndex = b;
ourConnects[a]->connectingVerts[index].edgeIndex = i;
numberOfConnections[a] +=1;
index = numberOfConnections[b];
ourConnects[b]->connectingVerts[index].vertexIndex = a;
ourConnects[b]->connectingVerts[index].edgeIndex = i;
numberOfConnections[b] +=1;
}
}
del = TRUE;
// else ourConnects = vConnects;
//spider out till hit our target or no more left
BOOL done = FALSE;
BOOL hit = FALSE;
Tab<int> vertsToDo;
BitArray processedVerts;
processedVerts.SetSize(ourConnects.Count());
processedVerts.ClearAll();
//if no more left bail
int currentVert = source;
while (!done)
{
// int startingNumberProcessed = processedVerts.NumberSet();
int ct = ourConnects[currentVert]->connectingVerts.Count();
processedVerts.Set(currentVert, TRUE);
for (int j = 0; j < ct; j++)
{
int index = ourConnects[currentVert]->connectingVerts[j].vertexIndex;
if (index == target)
{
done = TRUE;
hit = TRUE;
//.........这里部分代码省略.........
示例15: BuildInitialMapping
void MeshTopoData::BuildInitialMapping(MNMesh *msh)
{
//build bounding box
Box3 bbox;
bbox.Init();
int vertCount = 0;
//normalize the length width height
for (int i = 0; i < TVMaps.f.Count(); i++)
{
int pcount = 3;
pcount = TVMaps.f[i]->count;
vertCount += pcount;
for (int j = 0; j < pcount; j++)
{
bbox += TVMaps.geomPoints[TVMaps.f[i]->v[j]];
}
}
vertCount = msh->numv;
Tab<int> indexList;
indexList.SetCount(vertCount);
BitArray usedIndex;
usedIndex.SetSize(vertCount);
usedIndex.ClearAll();
for (int i = 0; i < vertCount; i++)
indexList[i] = -1;
for (int i = 0; i < TVMaps.f.Count(); i++)
{
if (!(TVMaps.f[i]->flags & FLAG_DEAD))
{
int pcount = 3;
pcount = TVMaps.f[i]->count;
for (int j = 0; j < pcount; j++)
{
usedIndex.Set(msh->f[i].vtx[j]);
}
}
}
int ct = 0;
for (int i = 0; i < usedIndex.GetSize(); i++)
{
if (usedIndex[i])
indexList[i] = ct++;
}
TVMaps.v.SetCount(usedIndex.NumberSet());
mVSel.SetSize(usedIndex.NumberSet());
//watje 10-19-99 bug 213437 to prevent a divide by 0 which gives you a huge u,v, or w value
if (bbox.Width().x == 0.0f) bbox += Point3(0.5f,0.0f,0.0f);
if (bbox.Width().y == 0.0f) bbox += Point3(0.0f,0.5f,0.0f);
if (bbox.Width().z == 0.0f) bbox += Point3(0.0f,0.0f,0.5f);
for (int i = 0; i < TVMaps.f.Count(); i++)
{
if (!(TVMaps.f[i]->flags & FLAG_DEAD))
{
int pcount = 3;
pcount = TVMaps.f[i]->count;
TVMaps.f[i]->flags &= ~FLAG_DEAD;
for (int j = 0; j < pcount; j++)
{
int index;
int a = msh->f[i].vtx[j];
index = indexList[a];
TVMaps.f[i]->t[j] = index;
Point3 uv( TVMaps.geomPoints[TVMaps.f[i]->v[j]].x/bbox.Width().x + 0.5f,
TVMaps.geomPoints[TVMaps.f[i]->v[j]].y/bbox.Width().y + 0.5f,
TVMaps.geomPoints[TVMaps.f[i]->v[j]].z/bbox.Width().z + 0.5f );
TVMaps.v[index].SetP(uv);
TVMaps.v[index].SetInfluence(0.f);
TVMaps.v[index].SetFlag(0);
TVMaps.v[index].SetControlID(-1);
}
}
}
}