本文整理汇总了C++中BitArray::Set方法的典型用法代码示例。如果您正苦于以下问题:C++ BitArray::Set方法的具体用法?C++ BitArray::Set怎么用?C++ BitArray::Set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BitArray
的用法示例。
在下文中一共展示了BitArray::Set方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Hit
void OverlapMap::Hit(UVWChannel &uvMesh,int mapIndex, int faceIndex,BitArray &selection)
{
BOOL hit = TRUE;
if (mBuffer[mapIndex].mFaceID == -1)
hit = FALSE;
//if nothing in this cell just add it
if (!hit)
{
mBuffer[mapIndex].mFaceID = faceIndex;
}
else
{
//have somethign in the cell need to check
//get the ld and face id in the cell
int baseFaceIndex = mBuffer[mapIndex].mFaceID;
//hit on the same mesh id cannot be the same
if ((baseFaceIndex != faceIndex))
{
selection.Set(faceIndex);
selection.Set(baseFaceIndex);
}
//hit on different mesh dont care about the face ids
}
}
示例2: 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;
}
}
示例3: 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);
}
示例4:
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);
}
}
}
}
}
示例5:
void MeshTopoData::AddVertsToCluster(int faceIndex, BitArray &processedVerts, ClusterClass *cluster)
{
int degree = TVMaps.f[faceIndex]->count;
for (int k = 0; k < degree; k++)
{
int index = TVMaps.f[faceIndex]->t[k];
if (!processedVerts[index])
{
cluster->verts.Append(1,&index,100);
processedVerts.Set(index,TRUE);
}
if (TVMaps.f[faceIndex]->vecs)
{
int index = TVMaps.f[faceIndex]->vecs->handles[k*2];
if (!processedVerts[index])
{
cluster->verts.Append(1,&index,100);
processedVerts.Set(index,TRUE);
}
index = TVMaps.f[faceIndex]->vecs->handles[k*2+1];
if (!processedVerts[index])
{
cluster->verts.Append(1,&index,100);
processedVerts.Set(index,TRUE);
}
index = TVMaps.f[faceIndex]->vecs->interiors[k];
if (!processedVerts[index])
{
cluster->verts.Append(1,&index,100);
processedVerts.Set(index,TRUE);
}
}
}
}
示例6: GrowSelection
void EditPolyData::GrowSelection (IMeshSelect *imod, int level) {
DbgAssert (mpMesh);
if( !mpMesh ) return;
BitArray newSel;
int mnSelLevel = meshSelLevel[level];
DbgAssert (mpMesh->GetFlag (MN_MESH_FILLED_IN));
if (!mpMesh->GetFlag (MN_MESH_FILLED_IN)) return;
SynchBitArrays();
int i;
switch (mnSelLevel) {
case MNM_SL_VERTEX:
for (i=0; i<mpMesh->numv; i++) mpMesh->v[i].SetFlag (MN_USER, mVertSel[i]!=0);
mpMesh->ClearEFlags (MN_USER);
mpMesh->PropegateComponentFlags (MNM_SL_EDGE, MN_USER, MNM_SL_VERTEX, MN_USER);
newSel.SetSize (mpMesh->numv);
for (i=0; i<mpMesh->nume; i++) {
if (mpMesh->e[i].GetFlag (MN_USER)) {
newSel.Set (mpMesh->e[i].v1);
newSel.Set (mpMesh->e[i].v2);
}
}
SetVertSel (newSel, imod, TimeValue(0));
break;
case MNM_SL_EDGE:
for (i=0; i<mpMesh->nume; i++) mpMesh->e[i].SetFlag (MN_USER, mEdgeSel[i]!=0);
mpMesh->ClearVFlags (MN_USER);
mpMesh->PropegateComponentFlags (MNM_SL_VERTEX, MN_USER, MNM_SL_EDGE, MN_USER);
newSel.SetSize (mpMesh->nume);
for (i=0; i<mpMesh->nume; i++) {
if (mpMesh->v[mpMesh->e[i].v1].GetFlag (MN_USER)
|| mpMesh->v[mpMesh->e[i].v2].GetFlag (MN_USER))
newSel.Set (i);
}
SetEdgeSel (newSel, imod, TimeValue(0));
break;
case MNM_SL_FACE:
for (i=0; i<mpMesh->numf; i++) mpMesh->f[i].SetFlag (MN_USER, mFaceSel[i]!=0);
mpMesh->ClearVFlags (MN_USER);
mpMesh->PropegateComponentFlags (MNM_SL_VERTEX, MN_USER, MNM_SL_FACE, MN_USER);
newSel.SetSize (mpMesh->numf);
for (i=0; i<mpMesh->numf; i++) {
int j;
for (j=0; j<mpMesh->f[i].deg; j++) {
if (mpMesh->v[mpMesh->f[i].vtx[j]].GetFlag (MN_USER)) break;
}
if (j<mpMesh->f[i].deg) newSel.Set (i);
}
SetFaceSel (newSel, imod, TimeValue(0));
break;
}
}
示例7: SetFaceValue
void EditFaceDataModData::SetFaceValue (BitArray & faces, float val) {
for (int i=0; i<faces.GetSize(); i++) {
if (!faces[i]) continue;
mFacesAffected.Set (i);
mtNewFaceValues[i] = val;
}
}
示例8: 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);
}
}
示例9: MNMesh_selectVertexLoops
void MNMesh_selectVertexLoops(MNMesh *mesh, int startid, BitArray &vertexloops)
{
BitArray secondarysel(mesh->ENum());
BitArray connectededges(mesh->ENum());
vertexloops.SetSize(mesh->VNum());
mesh->getEdgeSel(secondarysel);
// convert to Edge
Tab<int> &connected = mesh->vedg[startid];
for (int e=0; e < connected.Count(); e++){
connectededges.Set(connected[e]);
}
// loop edges
mesh->SelectEdgeLoop(connectededges);
// convert back to vertex
MNEdge *edge = mesh->e;
MNEdge *lastedge = edge+mesh->ENum();
int eid = 0;
while (edge < lastedge){
if (connectededges[eid]){
vertexloops.Set(edge->v1);
vertexloops.Set(edge->v2);
}
edge++;
eid++;
}
// select those vertices
mesh->VertexSelect(vertexloops);
// restore old edges
mesh->EdgeSelect(secondarysel);
}
示例10: 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();
}
}
}
}
示例11: Add
void Add (int ind)
{
if (!flags.Test(ind))
{
set.Append (ind);
flags.Set (ind);
}
}
示例12: GetWorkingArea
void GetWorkingArea(BitArray & working_elements, BitArray & working_points,
const Mesh & mesh, const Array<ElementIndex> & bad_elements,
const int width)
{
working_elements.Clear();
working_points.Clear();
for(int i=0; i<bad_elements.Size(); i++)
{
working_elements.Set(bad_elements[i]);
const Element & el = mesh[bad_elements[i]];
for(int j=1; j<=el.GetNP(); j++)
working_points.Set(el.PNum(j));
}
for(int i=0; i<width; i++)
{
for(ElementIndex j=0; j<mesh.GetNE(); j++)
{
if(!working_elements.Test(j))
{
const Element & el = mesh[j];
bool set_active = false;
for(int k=1; !set_active && k<=el.GetNP(); k++)
set_active = working_points.Test(el.PNum(k));
if(set_active)
working_elements.Set(j);
}
}
for(ElementIndex j=0; j<mesh.GetNE(); j++)
{
if(working_elements.Test(j))
{
const Element & el = mesh[j];
for(int k=1; k<=el.GetNP(); k++)
working_points.Set(el.PNum(k));
}
}
}
}
示例13: CollapseDeadSelections
void EditPolyData::CollapseDeadSelections (EditPolyMod *pMod, MNMesh & mesh)
{
BitArray delSet;
// Fix the vertex selection and hide arrays:
int max = mesh.numv;
if (max>mVertSel.GetSize()) max = mVertSel.GetSize ();
delSet.SetSize (max);
for (int i=0; i<max; i++) delSet.Set (i, mesh.v[i].GetFlag (MN_DEAD));
if (delSet.NumberSet()>0)
{
if (theHold.Holding()) theHold.Put (new EditPolySelectRestore (pMod, this, EPM_SL_VERTEX));
mVertSel.DeleteSet (delSet);
if (theHold.Holding()) theHold.Put (new EditPolyHideRestore (pMod, this, false));
mVertHide.DeleteSet (delSet);
}
// Fix the edge selection array:
max = mesh.nume;
if (max>mEdgeSel.GetSize()) max = mEdgeSel.GetSize ();
delSet.SetSize (max);
for (int i=0; i<max; i++) delSet.Set (i, mesh.e[i].GetFlag (MN_DEAD));
if (delSet.NumberSet()>0)
{
if (theHold.Holding()) theHold.Put (new EditPolySelectRestore (pMod, this, EPM_SL_EDGE));
mEdgeSel.DeleteSet (delSet);
}
// Fix the face selection and hide arrays:
max = mesh.numf;
if (max>mFaceSel.GetSize()) max = mFaceSel.GetSize ();
delSet.SetSize (max);
for (int i=0; i<max; i++) delSet.Set (i, mesh.f[i].GetFlag (MN_DEAD));
if (delSet.NumberSet()>0)
{
if (theHold.Holding()) theHold.Put (new EditPolySelectRestore (pMod, this, EPM_SL_FACE));
mFaceSel.DeleteSet (delSet);
if (theHold.Holding()) theHold.Put (new EditPolyHideRestore (pMod, this, true));
mFaceHide.DeleteSet (delSet);
}
}
示例14: 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);
}
示例15: pbBlurData
BlurMgr::BlurMgr() :
pbMaster(NULL), pbBlurData(NULL), pbSelData(NULL), mp_CCtl(NULL),
m_lastBMModifyID(0xFFFFFFFF), m_imageW(0), m_imageH(0), m_imageSz(0), m_compValid(false)
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
{
m_blurs[idBlurUnif] = new BlurUniform(this);
m_blurs[idBlurDir] = new BlurDirectional(this);
m_blurs[idBlurRadial] = new BlurRadial(this);
m_sels[idSelImage] = new SelImage(this);
m_sels[idSelIBack] = new SelIgnBack(this);
m_sels[idSelLum] = new SelLum(this);
m_sels[idSelMask] = new SelMaps(this);
m_sels[idSelObjIds] = new SelObjIds(this);
m_sels[idSelMatIds] = new SelMatIds(this);
// this added to allow extension of seltypes -- adding new param active ids breaks the original sequential enumeration
// i should have enumerated the param ids sparsely to allow for extensibility.
// if they are added sequentially, it changes the value of old param ids and will break loading of old versions
m_selActiveIds[idSelImage] = prmImageActive;
m_selActiveIds[idSelIBack] = prmIBackActive;
m_selActiveIds[idSelLum] = prmLumActive;
m_selActiveIds[idSelMask] = prmMaskActive;
m_selActiveIds[idSelObjIds] = prmObjIdsActive;
m_selActiveIds[idSelMatIds] = prmMatIdsActive;
// set default blur radial origin to coincide with current render settings
pbdBlurData.ParamOption(prmRadialXOrig, p_default, GetCOREInterface()->GetRendWidth()/2);
pbdBlurData.ParamOption(prmRadialYOrig, p_default, GetCOREInterface()->GetRendHeight()/2);
blurMgrCD.MakeAutoParamBlocks(this);
assert( pbMaster && pbBlurData && pbSelData);
// create a curve control and reference it
ICurveCtl *pICurveCtl = (ICurveCtl*)CreateInstance(REF_MAKER_CLASS_ID, CURVE_CONTROL_CLASS_ID);
assert (pICurveCtl);
ReplaceReference(idSelCurveCtrl, pICurveCtl);
pICurveCtl->RegisterResourceMaker(this);
pICurveCtl->SetCCFlags(CC_DRAWUTOOLBAR | CC_CONSTRAIN_Y | CC_SHOWRESET/*| CC_RCMENU_MOVE_XY | CC_RCMENU_MOVE_X | CC_RCMENU_MOVE_Y | CC_RCMENU_SCALE | CC_RCMENU_INSERT_CORNER | CC_RCMENU_INSERT_BEZIER | CC_RCMENU_DELETE*/);
pICurveCtl->SetXRange(0.0f,1.0f);
pICurveCtl->SetYRange(0.0f,1.0f);
BitArray ba;
ba.SetSize(32);
ba.Set(0);
ba.Clear(1);
pICurveCtl->SetDisplayMode(ba);
pICurveCtl->SetNumCurves(2);
pICurveCtl->SetScrollValues(2, -44);
pICurveCtl->SetZoomValues(133, 117);
}