public void Remove() { var ary = new FlexArray <int>() { 1, 2, 3 }; ary.Remove(1); ary.Is(new int[] { default(int), 2, 3 }); ary.Remove(2); ary.Is(new int[] { default(int), default(int), 3 }); ary.Remove(3); ary.Count.Is(0); ary = new FlexArray <int>() { 1, 2, 3 }; ary.Remove(2); ary.Remove(3); ary.Count.Is(1); ary[0].Is(1); }
// 全てのFaceを3角形に分割する public static void SplitAllFace(CadMesh mesh) { FlexArray <CadFace> faceStore = new FlexArray <CadFace>(); for (int i = 0; i < mesh.FaceStore.Count; i++) { CadFace face = mesh.FaceStore[i]; if (face.VList.Count < 3) { continue; } if (face.VList.Count == 3) { faceStore.Add(face); continue; } List <CadFace> flist = Split(face, mesh); faceStore.AddRange(flist); } mesh.FaceStore = faceStore; }
public static CadMesh CreateFrom(VertexList vl) { if (vl.Count < 2) { return(null); } CadMesh m = new CadMesh(vl.Count, 1); m.VertexStore.AddRange(vl); int i; FlexArray <int> nl = new FlexArray <int>(vl.Count); for (i = 0; i < vl.Count; i++) { nl.Add(i); } CadFace face = new CadFace(nl); m.FaceStore.Add(face); return(m); }
private static bool ListContainsPointInTriangle(CadFace triangle, CadFace face, CadMesh mesh) { FlexArray <int> tps = triangle.VList; for (int i = 0; i < face.VList.Count; i++) { Vector3d fv = mesh.VertexStore[face.VList[i]].vector; if ( fv.Equals(mesh.VertexStore[tps[0]].vector) || fv.Equals(mesh.VertexStore[tps[1]].vector) || fv.Equals(mesh.VertexStore[tps[2]].vector) ) { continue; } bool ret = IsPointInTriangle(fv, triangle, mesh); if (ret) { return(true); } } return(false); }
public void Indexer_ArgumentOutOfRangeException() { var ary = new FlexArray <int>() { 1, 2, 3 }; var _ = ary[-1]; }
public CadFace(params int[] args) { VList = new FlexArray <int>(args.Length); for (int i = 0; i < args.Length; i++) { VList.Add(args[i]); } }
public void CopyTo_ArgumentException() { int[] ary = new int[1]; var flexAry = new FlexArray <int>() { 10, 20 }; flexAry.CopyTo(ary, 0); }
public void Contains() { var ary = new FlexArray <int>() { 1, 2, 3 }; ary.Contains(2).Is(true); ary.Contains(4).Is(false); }
public static List <MpHeFace_v1002> HeFaceListToMp(FlexArray <HeFace> list) { List <MpHeFace_v1002> ret = new List <MpHeFace_v1002>(); for (int i = 0; i < list.Count; i++) { ret.Add(MpHeFace_v1002.Create(list[i])); } return(ret); }
public void Enumeration() { var ary = new FlexArray <int>() { 10, 20, 30 }; foreach (var _ in ary) { ; } }
public FlexArray <int> GetOuterEdge() { // Pairを持たないHalfEdgeのリストを作成 List <HalfEdge> heList = new List <HalfEdge>(); ForEachHalfEdge(he => { if (he.Pair == null) { heList.Add(he); } }); FlexArray <int> ret = new FlexArray <int>(); if (heList.Count <= 1) { return(ret); } int s = FindMaxDistantHalfEdge(CadVertex.Zero, heList); if (s == -1) { DOut.pl("HeModel.GetOuterEdge not found start HalfEdge"); return(ret); } int t = s; HalfEdge whe = heList[t]; int vi = whe.Vertex; heList.RemoveAt(t); while (true) { ret.Add(vi); vi = whe.Next.Vertex; t = FindHalfEdge(vi, heList); if (t == -1) { break; } whe = heList[t]; heList.RemoveAt(t); } return(ret); }
public void IndexOf() { var ary = new FlexArray <int>() { 10, 20, 30 }; ary.IndexOf(10).Is(0); ary.IndexOf(20).Is(1); ary.IndexOf(30).Is(2); ary.IndexOf(40).Is(-1); }
public static FlexArray <HeFace> HeFaceListFromMp( List <MpHeFace_v1002> list, Dictionary <uint, HalfEdge> dic ) { FlexArray <HeFace> ret = new FlexArray <HeFace>(); for (int i = 0; i < list.Count; i++) { ret.Add(list[i].Restore(dic)); } return(ret); }
public void Count() { var ary = new FlexArray <int>(); ary.Count.Is(0); for (int i = 1; i < 3; i++) { ary.Add(i); ary.Count.Is(i); } ary = new FlexArray <int>(); ary[2] = 10; ary.Count.Is(3); }
public void Add() { var ary = new FlexArray <int>(); for (int i = 0; i < 10; i++) { ary.Count.Is(i); ary.Add(i); ary.Count.Is(i + 1); } ary = new FlexArray <int>(); ary[2] = 10; ary.Count.Is(3); ary.Add(20); ary.Count.Is(4); ary[3].Is(20); }
public void Indexer() { var ary = new FlexArray <int>() { 1, 2, 3 }; ary[0].Is(1); ary[1].Is(2); ary[2].Is(3); ary[ary.Count].Is <int>(default(int)); ary = new FlexArray <int>(); ary[1] = 10; ary[0].Is(default(int)); ary[1].Is(10); }
public void Insert() { var ary = new FlexArray <int>(); ary.Insert(0, 10); ary[0].Is(10); ary.Insert(0, 20); ary.Is(new int[] { 20, 10 }); ary.Insert(1, 30); ary.Is(new int[] { 20, 30, 10 }); ary.Insert(ary.Count, 40); ary.Is(new int[] { 20, 30, 10, 40 }); ary.Insert(2, 50); ary.Is(new int[] { 20, 30, 50, 10, 40 }); ary.Insert(ary.Count + 1, 60); ary.Is(new int[] { 20, 30, 50, 10, 40, default(int), 60 }); }
public void Clear() { var ary = new FlexArray <int>(); ary.Count.Is(0); ary.Clear(); ary.Count.Is(0); ary.Add(10); ary[0] = 10; ary[0].Is(10); ary.Clear(); ary.Count.Is(0); ary[0].Is(default(int)); ary.Add(10); ary.Add(20); ary.Clear(); ary.Count.Is(0); ary[0].Is(default(int)); ary[1].Is(default(int)); }
public void RemoveAt() { var ary = new FlexArray <int>() { 10, 20, 30 }; ary.RemoveAt(1); ary.Is(new int[] { 10, default(int), 30 }); ary.RemoveAt(2); ary.Is(new int[] { 10 }); ary.RemoveAt(2); ary.Is(new int[] { 10 }); ary.RemoveAt(-1); ary.Is(new int[] { 10 }); ary.RemoveAt(0); ary.Count.Is(0); }
public void CopyTo() { int[] ary = new int[1]; var flexAry = new FlexArray <int>() { 10 }; flexAry.CopyTo(ary, 0); ary[0].Is(10); ary = new int[3]; flexAry = new FlexArray <int>() { 10, 20 }; flexAry.CopyTo(ary, 1); ary[1].Is(10); ary[2].Is(20); ary = new int[3]; flexAry = new FlexArray <int>() { 10, 20 }; flexAry.CopyTo(ary, 0); ary[0].Is(10); ary[1].Is(20); ary = new int[3]; flexAry = new FlexArray <int>() { 10, 20, 30 }; flexAry.CopyTo(ary, 0); ary.Is(flexAry); }
public CadFace(CadFace src) { VList = new FlexArray <int>(src.VList); }
public CadMesh(int vertexCount, int faceCount) { VertexStore = new VertexList(vertexCount); FaceStore = new FlexArray <CadFace>(faceCount); }
public PacketEnemyList(FlexArray <EnemyData> InList) { List = InList; }
public HeModel() { VertexStore = new VertexList(8); FaceStore = new FlexArray <HeFace>(6); NormalStore = new Vector3dList(8); }
public CadFace() { VList = new FlexArray <int>(3); }
public PacketPlayerList(FlexArray <PlayerData> InList) { List = InList; }
public CadFace(FlexArray <int> vl) { VList = new FlexArray <int>(vl); }