internal StkMesh(PMesh _base, int nf, double[,] matr) { Base = _base; int nv = Base.NV; int dim = Base.PDim; Matr = matr; Coords = new float[nv * dim]; Coords3D = new Vector3[nv]; CurPt = new double[dim]; NFace = nf; }
internal void SetStickers(LMesh M, CutNetwork CN, PAxis[] Axes, double[][] fctrs) { int dim = Pole.Length; NCutAxes = 0; int nax = Axes.Length; for (int i = 0; i < nax; i++) { if (AxisLayers[i] < 0) { NCutAxes++; } } CutAxes = new int[NCutAxes]; int d = 0; int rnk = 0; for (int u = 0; u < nax; u++) { if (AxisLayers[u] < 0) { CutAxes[d++] = u; } else { rnk += Axes[u].Base.GetRank(AxisLayers[u]); } } NStickers = CN.Nodes.Length; StickerMask = new byte[NStickers, NCutAxes]; StickerMesh = new PMesh[NStickers]; int nstk = 0; for (int i = 0; i < NStickers; i++) { PMesh xx = CN.GetPMesh(i); if (fctrs != null) { bool qg = false; foreach (double[] p in fctrs) { if (PGeom.VertEqual(p, xx.Ctr)) { qg = true; break; } } if (!qg) { continue; } } xx.FCtr = Pole; double[] ctr = xx.GetMCtr(); int rnk1 = rnk; for (int j = 0; j < NCutAxes; j++) { PAxis ax = Axes[CutAxes[j]]; double[] h = ax.Dir; double lh = PGeom.DotProd(h, h); double s = 0; for (int k = 0; k < dim; k++) { s += ctr[k] * h[k]; } s /= lh; int lv = ax.Base.NLayers - 1; for (int g = 0; g < lv; g++) { if (s > ax.Base.Cut[g]) { lv = g; break; } } rnk1 += ax.Base.GetRank(lv); StickerMask[nstk, j] = (byte)lv; } xx.Rank = rnk1; StickerMesh[nstk++] = xx; } if (nstk != NStickers) { PMesh[] stkm = new PMesh[nstk]; byte[,] stkmsk = new byte[nstk, NCutAxes]; for (int i = 0; i < nstk; i++) { stkm[i] = StickerMesh[i]; for (int j = 0; j < NCutAxes; j++) { stkmsk[i, j] = StickerMask[i, j]; } } StickerMask = stkmsk; StickerMesh = stkm; NStickers = nstk; } }