public DiscreteModel(InputModel inputModel, int patternSize, Coord3D outputSize, bool overlapping = true, bool periodic = true, bool addNeighbours = false, bool probabilisticModel = true) { mapOfChanges = new bool[outputSize.X, outputSize.Y, outputSize.Z]; neighboursMap = new Dictionary <int, Dictionary <Coord3D, List <int> > >(); this.periodic = periodic; this.probabilisticModel = probabilisticModel; this.patternSize = patternSize; numGen = 0; this.outputSize = outputSize; if (overlapping) { InitOverlappingModel(inputModel, patternSize, periodic); FindNeighbours(); } else { InitSimpleModel(inputModel, patternSize, false); InitNeighboursMap(periodic); if (addNeighbours) { DetectNeighbours(); } } InitOutputMatrix(outputSize); States = new Stack <List <int> [, , ]>(); ChosenPoints = new List <Coord3D>(); TotalRollbacks = 0; Debug.Log($"Model size: {new Vector3(inputModel.Size.X, inputModel.Size.Y, inputModel.Size.Z)}"); Debug.Log("Model Ready!"); }
public override Particle Closest(Particle main, double rad, List <Particle> toBeRemoved) { double rad2 = rad * rad; Coord3D coord = ParticleMap[main]; Particle response = null; double minDiff = double.MaxValue; foreach (var part in Grid[coord]) { Vector diff = main.Position - part.Position; double mag2 = diff.MagnitudeSquared; if (mag2 < rad2 && !toBeRemoved.Contains(part) && part != main && mag2 < minDiff) { response = part; minDiff = mag2; } } foreach (var point in nearby[coord]) { foreach (var part in point) { Vector diff = main.Position - part.Position; double mag2 = diff.MagnitudeSquared; if (mag2 < rad2 && !toBeRemoved.Contains(part) && part != main && mag2 < minDiff) { response = part; minDiff = mag2; } } } return(response); }
override public List <Particle> Nearby(Particle center, double rad, List <Particle> toBeRemoved) { double rad2 = rad * rad; Coord3D coord = ParticleMap[center]; List <Particle> response = new List <Particle>(); foreach (var part in Grid[coord]) { Vector diff = center.Position - part.Position; if (diff.MagnitudeSquared < rad2 && !toBeRemoved.Contains(part) && part != center) { response.Add(part); } } foreach (var point in nearby[coord]) { foreach (var part in point) { Vector diff = center.Position - part.Position; if (diff.MagnitudeSquared < rad2 && !toBeRemoved.Contains(part)) { response.Add(part); } } } return(response); }
public Line3D(Coord3D s, Coord3D e) : this(VisionLabPINVOKE.new_Line3D__SWIG_1(Coord3D.getCPtr(s), Coord3D.getCPtr(e)), true) { if (VisionLabPINVOKE.SWIGPendingException.Pending) { throw VisionLabPINVOKE.SWIGPendingException.Retrieve(); } }
//[SerializeField] private bool cleanOutput = false; private void Start() { var inputModel = Init(); var outputSizeInCoord = new Coord3D((int)outputSize.x, (int)outputSize.y, (int)outputSize.z); Model = new ConvolutionalModel(inputModel, patternSize, outputSizeInCoord, periodic, probabilisticModel); }
protected override void AddParticleDirectly(Particle part) { base.AddParticleDirectly(part); Coord3D coord = TransformToCoord(part.Position); ParticleMap.Add(part, coord); Grid[coord].AddLast(part); }
private void Start() { var inputModel = Init(); var outputSizeInCoord = new Coord3D((int)outputSize.x, (int)outputSize.y, (int)outputSize.z); Model = new SimpleModel(inputModel, patternSize, outputSizeInCoord, periodic, augmentNeighbours, probabilisticModel); }
internal static TransitionDamageFXList Parse(IniParser parser) { return(new TransitionDamageFXList { Location = parser.ParseAttribute("Loc", () => Coord3D.Parse(parser)), FXList = parser.ParseAttribute("FXList", () => parser.ParseAssetReference()) }); }
public void GenerateUvs(Vector2[] uvs) { for (int i = 0; i < 4; i++) { Vector2 uv; switch (i) { case 0: uv = new Vector2(0, 0); break; case 1: uv = new Vector2(0, 1); break; case 2: uv = new Vector2(1, 1); break; case 3: uv = new Vector2(1, 0); break; default: uv = new Vector2(0, 0); break; } uv /= 4; Coord3D dirVector = dir.Coord; if (dirVector == Coord3D.up) { uv += new Vector2(0.25f, 0.25f); } if (dirVector == Coord3D.down) { uv += new Vector2(0.25f, 0); } if (dirVector == Coord3D.left) { uv += new Vector2(0.5f, 0f); } if (dirVector == Coord3D.right) { uv += new Vector2(0.5f, 0.25f); } if (dirVector == Coord3D.front) { uv += new Vector2(0.0f, 0.25f); } if (dirVector == Coord3D.back) { uv += new Vector2(0, 0); } switch (i) { case 0: uvs[v0] = uv; break; case 1: uvs[v1] = uv; break; case 2: uvs[v2] = uv; break; case 3: uvs[v3] = uv; break; } } }
public void BuildWorldObject(Coord2D mouseIsoFlatCoord, Coord2D mouseIsoCoord) { Coord3D mouseIsoCoord3D = new Coord3D(mouseIsoCoord, Altitude); if (BuildMode == BuildMode.Cube) { // Create cube and add it to the layer map. var cube = CubeFactory.CreateCurrentCube(mouseIsoFlatCoord, mouseIsoCoord3D); if (!LayerMap.ContainsKey(mouseIsoCoord3D)) { LayerMap.Add(mouseIsoCoord3D, cube); } // Deal with the walkable tile table. foreach (var coord in mouseIsoCoord.AdjacentCoords()) { // If there are no solid objects above us, if (!(LayerMap.ContainsKey(new Coord3D(mouseIsoCoord, Altitude + 1)) && LayerMap[new Coord3D(mouseIsoCoord, Altitude + 1)].IsSolid)) // not- contains key and sprite is solid { WalkableTileTable.Add(Altitude + 1, coord, mouseIsoCoord); } // Assuming the added cube is solid, the tile under us is no longer walkable. if (cube.IsSolid) { WalkableTileTable.Remove(Altitude, coord, mouseIsoCoord); } } } else if (BuildMode == BuildMode.Deco) { // Create deco and add it to the layer map. var deco = DecoFactory.CreateCurrentDeco(mouseIsoFlatCoord, mouseIsoCoord, Altitude); if (deco.OccupiedCoords.Any((c) => LayerMap.ContainsKey(c)) == false) { LayerMap.Add(mouseIsoCoord3D, deco); foreach (var coord in deco.OccupiedCoords) { if (coord != mouseIsoCoord3D) { LayerMap.Add(coord, new DecoReference(deco, mouseIsoCoord3D) { Coords = coord.To2D(), Altitude = coord.Z }); } foreach (var _coord in new Coord2D(coord.X, coord.Y).AdjacentCoords()) { // Assuming the added deco is solid, the tiles under us are no longer walkable. if (deco.IsSolid) { WalkableTileTable.Remove(Altitude, _coord, new Coord2D(coord.X, coord.Y)); } } } } } }
public Coord3D ImageCToCamC(Coord2D imageC) { Coord3D ret = new Coord3D(VisionLabPINVOKE.CamCalibration_ImageCToCamC(swigCPtr, Coord2D.getCPtr(imageC)), true); if (VisionLabPINVOKE.SWIGPendingException.Pending) { throw VisionLabPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public Coord3D Divide(double f) { Coord3D ret = new Coord3D(VisionLabPINVOKE.Coord3D_Divide(swigCPtr, f), true); if (VisionLabPINVOKE.SWIGPendingException.Pending) { throw VisionLabPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public bool Not(Coord3D c) { bool ret = VisionLabPINVOKE.Coord3D_Not(swigCPtr, Coord3D.getCPtr(c)); if (VisionLabPINVOKE.SWIGPendingException.Pending) { throw VisionLabPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public Coord3D Add_Op(Coord3D c) { Coord3D ret = new Coord3D(VisionLabPINVOKE.Coord3D_Add_Op(swigCPtr, Coord3D.getCPtr(c)), true); if (VisionLabPINVOKE.SWIGPendingException.Pending) { throw VisionLabPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public Coord3D PixelCToWorldC(Coord2D pixelC) { Coord3D ret = new Coord3D(VisionLabPINVOKE.CamCalibration_PixelCToWorldC(swigCPtr, Coord2D.getCPtr(pixelC)), true); if (VisionLabPINVOKE.SWIGPendingException.Pending) { throw VisionLabPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public bool SmallerThan(Coord3D arg0) { bool ret = VisionLabPINVOKE.Coord3D_SmallerThan(swigCPtr, Coord3D.getCPtr(arg0)); if (VisionLabPINVOKE.SWIGPendingException.Pending) { throw VisionLabPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
protected override void RemoveParticleDirectly(Particle part) { base.RemoveParticleDirectly(part); if (ParticleMap.ContainsKey(part)) { Coord3D coord = ParticleMap[part]; Grid[coord].Remove(part); ParticleMap.Remove(part); } }
private static void ReadConfigFile(out string portName, out Coord3D[] anchorArray, string path) { var parser = new FileIniDataParser(); var data = parser.ReadFile(path); portName = data["tag"]["port"]; anchorArray = new[] { Coord3D.FromString(data["anchors"]["0"]), Coord3D.FromString(data["anchors"]["1"]), Coord3D.FromString(data["anchors"]["2"]) }; }
public static bool OutOfBounds <T>(this T[,,] array, Coord3D coords) { if (coords.X >= array.GetLowerBound(0) && coords.X <= array.GetUpperBound(0) && coords.Y >= array.GetLowerBound(1) && coords.Y <= array.GetUpperBound(1) && coords.Z >= array.GetLowerBound(2) && coords.Z <= array.GetUpperBound(2)) { return(false); } else { return(true); } }
/// <summary> /// Advance all particles /// </summary> public override void Update(double deltaTime) { base.Update(deltaTime); foreach (var part in ParticleMap.Keys.ToList()) { Coord3D oldCoord = ParticleMap[part]; Coord3D newCoord = TransformToCoord(part.Position); ParticleMap[part] = newCoord; Grid[oldCoord].Remove(part); Grid[newCoord].AddLast(part); } }
public void RemoveWorldObject(Coord2D mouseIsoFlatCoord, Coord2D mouseIsoCoord) { Coord3D mouseIsoCoord3D = new Coord3D(mouseIsoCoord, Altitude); if (BuildMode == BuildMode.Cube && LayerMap.ContainsKey(mouseIsoCoord3D)) { var sprite = LayerMap[mouseIsoCoord3D]; if (sprite is Cube) { LayerMap.Remove(mouseIsoCoord3D); foreach (var coord in mouseIsoCoord.AdjacentCoords()) { WalkableTileTable.Remove(Altitude + 1, coord, mouseIsoCoord); } // If there is a cube below, if (LayerMap.ContainsKey(new Coord3D(mouseIsoCoord, Altitude - 1)) && LayerMap[new Coord3D(mouseIsoCoord, Altitude - 1)] is Cube) { foreach (var coord in mouseIsoCoord.AdjacentCoords()) { WalkableTileTable.Add(Altitude, coord, mouseIsoCoord); } } } } else if (BuildMode == BuildMode.Deco && LayerMap.ContainsKey(mouseIsoCoord3D)) { var sprite = LayerMap[mouseIsoCoord3D]; if (sprite is Deco deco) { foreach (var coord in deco.OccupiedCoords) { LayerMap.Remove(coord); // If there are cubes below, var c = new Coord3D(new Coord2D(coord.X, coord.Y), Altitude - 1); if (LayerMap.ContainsKey(c) && LayerMap[c] is Cube) { foreach (var _coord in new Coord2D(coord.X, coord.Y).AdjacentCoords()) { WalkableTileTable.Add(Altitude, _coord, new Coord2D(coord.X, coord.Y)); } } } } } }
public ParticleContainerGrid(double xsize, double ysize, double zsize, int xdiv, int ydiv, int zdiv) : base(xsize, ysize, zsize) { limits = new Coord3D(xdiv, ydiv, zdiv); intervals = new Vector(xsize / xdiv, ysize / ydiv, zsize / zdiv); for (int ix = 0; ix < xdiv; ++ix) { for (int iy = 0; iy < ydiv; ++iy) { for (int iz = 0; iz < zdiv; ++iz) { Grid.Add(new Coord3D(ix, iy, iz), new LinkedList <Particle>()); } } } }
public ConvolutionalModel(InputModel inputModel, int patternSize, Coord3D outputSize, bool periodic, bool probabilisticModel) { NeighboursMap = new Dictionary <int, Dictionary <Coord3D, List <int> > >(); Periodic = periodic; ProbabilisticModel = probabilisticModel; PatternSize = patternSize; NumGen = 0; OutputSize = outputSize; Init(inputModel, patternSize, periodic); FindNeighbours(); InitOutputMatrix(outputSize); Debug.Log($"Model size: {new Vector3(inputModel.Size.X, inputModel.Size.Y, inputModel.Size.Z)}"); Debug.Log("Model Ready!"); }
protected void InitOutputMatrix(Coord3D size) { outputMatrix = new List <int> [size.X, size.Y, size.Z]; for (var x = 0; x < size.X; x++) { for (var y = 0; y < size.Y; y++) { for (var z = 0; z < size.Z; z++) { outputMatrix[x, y, z] = new List <int>(); for (var i = 0; i < patterns.Count; i++) { outputMatrix[x, y, z].Add(i); } } } } }
public FancyParticleContainerGrid(double xsize, double ysize, double zsize, int xdiv, int ydiv, int zdiv) : base(xsize, ysize, zsize, xdiv, ydiv, zdiv) { foreach (var pair in Grid) { nearby.Add(pair.Key, new List <LinkedList <Particle> >()); for (int ix = -1; ix <= 1; ++ix) { for (int iy = -1; iy <= 1; ++iy) { for (int iz = -1; iz <= 1; ++iz) { Coord3D coord = new Coord3D(pair.Key.X + ix, pair.Key.Y + iy, pair.Key.Z + iz); if (coord != pair.Key && CheckCoord(coord)) { nearby[pair.Key].Add(Grid[coord]); } } } } } }
public static Coord3D StrToCoord3D(string str) { Coord3D ret = new Coord3D(VisionLabPINVOKE.StrToCoord3D(str), true); if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve(); return ret; }
public static string Coord3DToStr(Coord3D xyz) { string ret = VisionLabPINVOKE.Coord3DToStr(Coord3D.getCPtr(xyz)); if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve(); return ret; }
public DecoReference(Deco reference, Coord3D referenceCoord) { Reference = reference; ReferenceCoord = referenceCoord; }
public static bool FitsPattern(this byte[,,] pattern, byte[,,] otherPattern, Coord3D side) { int startX = 0; int startY = 0; int startZ = 0; int endX = pattern.GetLength(0); int endY = pattern.GetLength(1); int endZ = pattern.GetLength(2); int startX2 = 0; int startY2 = 0; int startZ2 = 0; int endX2 = pattern.GetLength(0); int endY2 = pattern.GetLength(1); int endZ2 = pattern.GetLength(2); if (side.Equals(Coord3D.Left)) { startX = pattern.GetLength(0) - 1; endX2 = 1; } else if (side.Equals(Coord3D.Right)) { endX = 1; startX2 = pattern.GetLength(0) - 1; } else if (side.Equals(Coord3D.Down)) { endY = 1; startY2 = pattern.GetLength(1) - 1; } else if (side.Equals(Coord3D.Up)) { startY = pattern.GetLength(1) - 1; endY2 = 1; } else if (side.Equals(Coord3D.Back)) { startZ = pattern.GetLength(2) - 1; endZ2 = 1; } else if (side.Equals(Coord3D.Forward)) { endZ = 1; startZ2 = pattern.GetLength(2) - 1; } var loopX2 = startX2; var loopY2 = startY2; var loopZ2 = startZ2; for (var x = startX; x < endX; x++) { for (var y = startY; y < endY; y++) { for (var z = startZ; z < endZ; z++) { if (pattern[x, y, z] != otherPattern[loopX2, loopY2, loopZ2]) { return(false); } loopZ2++; } loopZ2 = startZ2; loopY2++; } loopY2 = startY2; loopX2++; } return(true); }
public Coord3D CamCToWorldC(Coord3D camC) { Coord3D ret = new Coord3D(VisionLabPINVOKE.CamCalibration_CamCToWorldC(swigCPtr, Coord3D.getCPtr(camC)), true); if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve(); return ret; }
public Coord3D ImageCToCamC(Coord2D imageC) { Coord3D ret = new Coord3D(VisionLabPINVOKE.CamCalibration_ImageCToCamC(swigCPtr, Coord2D.getCPtr(imageC)), true); if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve(); return ret; }
public Line3D(Coord3D s, Coord3D e) : this(VisionLabPINVOKE.new_Line3D__SWIG_1(Coord3D.getCPtr(s), Coord3D.getCPtr(e)), true) { if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve(); }
public static double Distance(Coord3D p1, Coord3D p2) { double ret = VisionLabPINVOKE.Distance__SWIG_4(Coord3D.getCPtr(p1), Coord3D.getCPtr(p2)); if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve(); return ret; }
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Coord3D obj) { return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr); }
public static List <(int, int)> CreateWeldLinks(Face[] faces) { List <(int, int)> weldLinks = new List <(int, int)>(capacity: faces.Length * 4); //creating a coord-to-faceNum lut of directional faces Dictionary <Coord3D, int> topFaces = new Dictionary <Coord3D, int>(); Dictionary <Coord3D, int> bottomFaces = new Dictionary <Coord3D, int>(); Dictionary <Coord3D, int> leftFaces = new Dictionary <Coord3D, int>(); Dictionary <Coord3D, int> rightFaces = new Dictionary <Coord3D, int>(); Dictionary <Coord3D, int> frontFaces = new Dictionary <Coord3D, int>(); Dictionary <Coord3D, int> backFaces = new Dictionary <Coord3D, int>(); for (int f = 0; f < faces.Length; f++) { switch (faces[f].dir.val) { case 0b_00_010_000: topFaces.Add(faces[f].coord, f); break; case 0b_00_000_010: bottomFaces.Add(faces[f].coord, f); break; case 0b_00_000_100: leftFaces.Add(faces[f].coord, f); break; case 0b_00_100_000: rightFaces.Add(faces[f].coord, f); break; case 0b_00_001_000: frontFaces.Add(faces[f].coord, f); break; case 0b_00_000_001: backFaces.Add(faces[f].coord, f); break; default: throw new Exception("Unknown Direction on welding faces"); } } //top foreach (KeyValuePair <Coord3D, int> kvp in topFaces) { Coord3D coord = kvp.Key; int f = kvp.Value; { if (frontFaces.TryGetValue(coord, out int cf)) { weldLinks.Add((faces[cf].v2, faces[f].v1)); weldLinks.Add((faces[cf].v1, faces[f].v2)); } else if (topFaces.TryGetValue(coord + Coord3D.front, out int nf)) { weldLinks.Add((faces[nf].v0, faces[f].v1)); weldLinks.Add((faces[nf].v3, faces[f].v2)); } else if (backFaces.TryGetValue(coord + Coord3D.front + Coord3D.up, out int of)) { weldLinks.Add((faces[of].v0, faces[f].v1)); weldLinks.Add((faces[of].v3, faces[f].v2)); } } { if (backFaces.TryGetValue(coord, out int cf)) { weldLinks.Add((faces[cf].v1, faces[f].v0)); weldLinks.Add((faces[cf].v2, faces[f].v3)); } else if (topFaces.TryGetValue(coord + Coord3D.back, out int nf)) { weldLinks.Add((faces[nf].v1, faces[f].v0)); weldLinks.Add((faces[nf].v2, faces[f].v3)); } else if (frontFaces.TryGetValue(coord + Coord3D.back + Coord3D.up, out int of)) { weldLinks.Add((faces[of].v3, faces[f].v0)); weldLinks.Add((faces[of].v0, faces[f].v3)); } } { if (leftFaces.TryGetValue(coord, out int cf)) { weldLinks.Add((faces[cf].v2, faces[f].v0)); weldLinks.Add((faces[cf].v1, faces[f].v1)); } else if (topFaces.TryGetValue(coord + Coord3D.left, out int nf)) { weldLinks.Add((faces[nf].v3, faces[f].v0)); weldLinks.Add((faces[nf].v2, faces[f].v1)); } else if (rightFaces.TryGetValue(coord + Coord3D.up + Coord3D.left, out int of)) { weldLinks.Add((faces[of].v0, faces[f].v0)); weldLinks.Add((faces[of].v3, faces[f].v1)); } } { if (rightFaces.TryGetValue(coord, out int cf)) { weldLinks.Add((faces[cf].v2, faces[f].v2)); weldLinks.Add((faces[cf].v1, faces[f].v3)); } else if (topFaces.TryGetValue(coord + Coord3D.right, out int nf)) { weldLinks.Add((faces[nf].v1, faces[f].v2)); weldLinks.Add((faces[nf].v0, faces[f].v3)); } else if (leftFaces.TryGetValue(coord + Coord3D.up + Coord3D.right, out int of)) { weldLinks.Add((faces[of].v0, faces[f].v2)); weldLinks.Add((faces[of].v3, faces[f].v3)); } } } //bottom foreach (KeyValuePair <Coord3D, int> kvp in bottomFaces) { Coord3D coord = kvp.Key; int f = kvp.Value; { if (frontFaces.TryGetValue(coord, out int cf)) { weldLinks.Add((faces[cf].v3, faces[f].v0)); weldLinks.Add((faces[cf].v0, faces[f].v3)); } else if (bottomFaces.TryGetValue(coord + Coord3D.front, out int nf)) { weldLinks.Add((faces[nf].v1, faces[f].v0)); weldLinks.Add((faces[nf].v2, faces[f].v3)); } else if (backFaces.TryGetValue(coord + Coord3D.down + Coord3D.front, out int of)) { weldLinks.Add((faces[of].v1, faces[f].v0)); weldLinks.Add((faces[of].v2, faces[f].v3)); } } { if (backFaces.TryGetValue(coord, out int cf)) { weldLinks.Add((faces[cf].v0, faces[f].v1)); weldLinks.Add((faces[cf].v3, faces[f].v2)); } else if (bottomFaces.TryGetValue(coord + Coord3D.back, out int nf)) { weldLinks.Add((faces[nf].v0, faces[f].v1)); weldLinks.Add((faces[nf].v3, faces[f].v2)); } else if (frontFaces.TryGetValue(coord + Coord3D.down + Coord3D.back, out int of)) { weldLinks.Add((faces[of].v2, faces[f].v1)); weldLinks.Add((faces[of].v1, faces[f].v2)); } } { if (leftFaces.TryGetValue(coord, out int cf)) { weldLinks.Add((faces[cf].v0, faces[f].v0)); weldLinks.Add((faces[cf].v3, faces[f].v1)); } else if (bottomFaces.TryGetValue(coord + Coord3D.left, out int nf)) { weldLinks.Add((faces[nf].v3, faces[f].v0)); weldLinks.Add((faces[nf].v2, faces[f].v1)); } else if (rightFaces.TryGetValue(coord + Coord3D.down + Coord3D.left, out int of)) { weldLinks.Add((faces[of].v2, faces[f].v0)); weldLinks.Add((faces[of].v1, faces[f].v1)); } } { if (rightFaces.TryGetValue(coord, out int cf)) { weldLinks.Add((faces[cf].v0, faces[f].v2)); weldLinks.Add((faces[cf].v3, faces[f].v3)); } else if (bottomFaces.TryGetValue(coord + Coord3D.right, out int nf)) { weldLinks.Add((faces[nf].v1, faces[f].v2)); weldLinks.Add((faces[nf].v0, faces[f].v3)); } else if (leftFaces.TryGetValue(coord + Coord3D.down + Coord3D.right, out int of)) { weldLinks.Add((faces[of].v2, faces[f].v2)); weldLinks.Add((faces[of].v1, faces[f].v3)); } } } //front foreach (KeyValuePair <Coord3D, int> kvp in frontFaces) { Coord3D coord = kvp.Key; int f = kvp.Value; { if (topFaces.TryGetValue(coord, out int cf)) { weldLinks.Add((faces[cf].v2, faces[f].v1)); weldLinks.Add((faces[cf].v1, faces[f].v2)); } else if (frontFaces.TryGetValue(coord + Coord3D.up, out int nf)) { weldLinks.Add((faces[nf].v0, faces[f].v1)); weldLinks.Add((faces[nf].v3, faces[f].v2)); } else if (bottomFaces.TryGetValue(coord + Coord3D.front + Coord3D.up, out int of)) { weldLinks.Add((faces[of].v2, faces[f].v1)); weldLinks.Add((faces[of].v1, faces[f].v2)); } } { if (bottomFaces.TryGetValue(coord, out int cf)) { weldLinks.Add((faces[cf].v3, faces[f].v0)); weldLinks.Add((faces[cf].v0, faces[f].v3)); } else if (frontFaces.TryGetValue(coord + Coord3D.down, out int nf)) { weldLinks.Add((faces[nf].v1, faces[f].v0)); weldLinks.Add((faces[nf].v2, faces[f].v3)); } else if (topFaces.TryGetValue(coord + Coord3D.front + Coord3D.down, out int of)) { weldLinks.Add((faces[of].v3, faces[f].v0)); weldLinks.Add((faces[of].v0, faces[f].v3)); } } { if (leftFaces.TryGetValue(coord, out int cf)) { weldLinks.Add((faces[cf].v1, faces[f].v2)); weldLinks.Add((faces[cf].v0, faces[f].v3)); } else if (frontFaces.TryGetValue(coord + Coord3D.left, out int nf)) { weldLinks.Add((faces[nf].v1, faces[f].v2)); weldLinks.Add((faces[nf].v0, faces[f].v3)); } else if (rightFaces.TryGetValue(coord + Coord3D.front + Coord3D.left, out int of)) { weldLinks.Add((faces[of].v1, faces[f].v2)); weldLinks.Add((faces[of].v0, faces[f].v3)); } } { if (rightFaces.TryGetValue(coord, out int cf)) { weldLinks.Add((faces[cf].v2, faces[f].v1)); weldLinks.Add((faces[cf].v3, faces[f].v0)); } else if (frontFaces.TryGetValue(coord + Coord3D.right, out int nf)) { weldLinks.Add((faces[nf].v2, faces[f].v1)); weldLinks.Add((faces[nf].v3, faces[f].v0)); } else if (leftFaces.TryGetValue(coord + Coord3D.front + Coord3D.right, out int of)) { weldLinks.Add((faces[of].v2, faces[f].v1)); weldLinks.Add((faces[of].v3, faces[f].v0)); } } } //back foreach (KeyValuePair <Coord3D, int> kvp in backFaces) { Coord3D coord = kvp.Key; int f = kvp.Value; { if (topFaces.TryGetValue(coord, out int cf)) { weldLinks.Add((faces[cf].v0, faces[f].v1)); weldLinks.Add((faces[cf].v3, faces[f].v2)); } else if (backFaces.TryGetValue(coord + Coord3D.up, out int nf)) { weldLinks.Add((faces[nf].v0, faces[f].v1)); weldLinks.Add((faces[nf].v3, faces[f].v2)); } else if (bottomFaces.TryGetValue(coord + Coord3D.back + Coord3D.up, out int of)) { weldLinks.Add((faces[of].v0, faces[f].v1)); weldLinks.Add((faces[of].v3, faces[f].v2)); } } { if (bottomFaces.TryGetValue(coord, out int cf)) { weldLinks.Add((faces[cf].v1, faces[f].v0)); weldLinks.Add((faces[cf].v2, faces[f].v3)); } else if (backFaces.TryGetValue(coord + Coord3D.down, out int nf)) { weldLinks.Add((faces[nf].v1, faces[f].v0)); weldLinks.Add((faces[nf].v2, faces[f].v3)); } else if (topFaces.TryGetValue(coord + Coord3D.back + Coord3D.down, out int of)) { weldLinks.Add((faces[of].v1, faces[f].v0)); weldLinks.Add((faces[of].v2, faces[f].v3)); } } { if (leftFaces.TryGetValue(coord, out int cf)) { weldLinks.Add((faces[cf].v3, faces[f].v0)); weldLinks.Add((faces[cf].v2, faces[f].v1)); } else if (backFaces.TryGetValue(coord + Coord3D.left, out int nf)) { weldLinks.Add((faces[nf].v3, faces[f].v0)); weldLinks.Add((faces[nf].v2, faces[f].v1)); } else if (rightFaces.TryGetValue(coord + Coord3D.back + Coord3D.left, out int of)) { weldLinks.Add((faces[of].v3, faces[f].v0)); weldLinks.Add((faces[of].v2, faces[f].v1)); } } { if (rightFaces.TryGetValue(coord, out int cf)) { weldLinks.Add((faces[cf].v1, faces[f].v2)); weldLinks.Add((faces[cf].v0, faces[f].v3)); } else if (backFaces.TryGetValue(coord + Coord3D.right, out int nf)) { weldLinks.Add((faces[nf].v1, faces[f].v2)); weldLinks.Add((faces[nf].v0, faces[f].v3)); } else if (leftFaces.TryGetValue(coord + Coord3D.back + Coord3D.right, out int of)) { weldLinks.Add((faces[of].v1, faces[f].v2)); weldLinks.Add((faces[of].v0, faces[f].v3)); } } } //left foreach (KeyValuePair <Coord3D, int> kvp in leftFaces) { Coord3D coord = kvp.Key; int f = kvp.Value; { if (topFaces.TryGetValue(coord, out int cf)) { weldLinks.Add((faces[cf].v1, faces[f].v1)); weldLinks.Add((faces[cf].v0, faces[f].v2)); } else if (leftFaces.TryGetValue(coord + Coord3D.up, out int nf)) { weldLinks.Add((faces[nf].v0, faces[f].v1)); weldLinks.Add((faces[nf].v3, faces[f].v2)); } else if (bottomFaces.TryGetValue(coord + Coord3D.left + Coord3D.up, out int of)) { weldLinks.Add((faces[of].v3, faces[f].v1)); weldLinks.Add((faces[of].v2, faces[f].v2)); } } { if (bottomFaces.TryGetValue(coord, out int cf)) { weldLinks.Add((faces[cf].v0, faces[f].v0)); weldLinks.Add((faces[cf].v1, faces[f].v3)); } else if (leftFaces.TryGetValue(coord + Coord3D.down, out int nf)) { weldLinks.Add((faces[nf].v1, faces[f].v0)); weldLinks.Add((faces[nf].v2, faces[f].v3)); } else if (topFaces.TryGetValue(coord + Coord3D.left + Coord3D.down, out int of)) { weldLinks.Add((faces[of].v2, faces[f].v0)); weldLinks.Add((faces[of].v3, faces[f].v3)); } } { if (frontFaces.TryGetValue(coord, out int cf)) { weldLinks.Add((faces[cf].v3, faces[f].v0)); weldLinks.Add((faces[cf].v2, faces[f].v1)); } else if (leftFaces.TryGetValue(coord + Coord3D.front, out int nf)) { weldLinks.Add((faces[nf].v3, faces[f].v0)); weldLinks.Add((faces[nf].v2, faces[f].v1)); } else if (backFaces.TryGetValue(coord + Coord3D.left + Coord3D.front, out int of)) { weldLinks.Add((faces[of].v3, faces[f].v0)); weldLinks.Add((faces[of].v2, faces[f].v1)); } } { if (backFaces.TryGetValue(coord, out int cf)) { weldLinks.Add((faces[cf].v1, faces[f].v2)); weldLinks.Add((faces[cf].v0, faces[f].v3)); } else if (leftFaces.TryGetValue(coord + Coord3D.back, out int nf)) { weldLinks.Add((faces[nf].v1, faces[f].v2)); weldLinks.Add((faces[nf].v0, faces[f].v3)); } else if (frontFaces.TryGetValue(coord + Coord3D.left + Coord3D.back, out int of)) { weldLinks.Add((faces[of].v1, faces[f].v2)); weldLinks.Add((faces[of].v0, faces[f].v3)); } } } //right foreach (KeyValuePair <Coord3D, int> kvp in rightFaces) { Coord3D coord = kvp.Key; int f = kvp.Value; { if (topFaces.TryGetValue(coord, out int cf)) { weldLinks.Add((faces[cf].v3, faces[f].v1)); weldLinks.Add((faces[cf].v2, faces[f].v2)); } else if (rightFaces.TryGetValue(coord + Coord3D.up, out int nf)) { weldLinks.Add((faces[nf].v0, faces[f].v1)); weldLinks.Add((faces[nf].v3, faces[f].v2)); } else if (bottomFaces.TryGetValue(coord + Coord3D.right + Coord3D.up, out int of)) { weldLinks.Add((faces[of].v1, faces[f].v1)); weldLinks.Add((faces[of].v0, faces[f].v2)); } } { if (bottomFaces.TryGetValue(coord, out int cf)) { weldLinks.Add((faces[cf].v2, faces[f].v0)); weldLinks.Add((faces[cf].v3, faces[f].v3)); } else if (rightFaces.TryGetValue(coord + Coord3D.down, out int nf)) { weldLinks.Add((faces[nf].v1, faces[f].v0)); weldLinks.Add((faces[nf].v2, faces[f].v3)); } else if (topFaces.TryGetValue(coord + Coord3D.right + Coord3D.down, out int of)) { weldLinks.Add((faces[of].v0, faces[f].v0)); weldLinks.Add((faces[of].v1, faces[f].v3)); } } { if (frontFaces.TryGetValue(coord, out int cf)) { weldLinks.Add((faces[cf].v1, faces[f].v2)); weldLinks.Add((faces[cf].v0, faces[f].v3)); } else if (rightFaces.TryGetValue(coord + Coord3D.front, out int nf)) { weldLinks.Add((faces[nf].v1, faces[f].v2)); weldLinks.Add((faces[nf].v0, faces[f].v3)); } else if (backFaces.TryGetValue(coord + Coord3D.right + Coord3D.front, out int of)) { weldLinks.Add((faces[of].v1, faces[f].v2)); weldLinks.Add((faces[of].v0, faces[f].v3)); } } { if (backFaces.TryGetValue(coord, out int cf)) { weldLinks.Add((faces[cf].v3, faces[f].v0)); weldLinks.Add((faces[cf].v2, faces[f].v1)); } else if (rightFaces.TryGetValue(coord + Coord3D.back, out int nf)) { weldLinks.Add((faces[nf].v3, faces[f].v0)); weldLinks.Add((faces[nf].v2, faces[f].v1)); } else if (frontFaces.TryGetValue(coord + Coord3D.right + Coord3D.back, out int of)) { weldLinks.Add((faces[of].v3, faces[f].v0)); weldLinks.Add((faces[of].v2, faces[f].v1)); } } } return(weldLinks); }
public Coord3D Add(Coord3D c) { Coord3D ret = new Coord3D(VisionLabPINVOKE.Coord3D_Add(swigCPtr, Coord3D.getCPtr(c)), true); if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve(); return ret; }
public Coord3D Divide_Op(double f) { Coord3D ret = new Coord3D(VisionLabPINVOKE.Coord3D_Divide_Op(swigCPtr, f), true); if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve(); return ret; }
internal static HandleRef getCPtr(Coord3D obj) { return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; }
public bool SmallerThan(Coord3D arg0) { bool ret = VisionLabPINVOKE.Coord3D_SmallerThan(swigCPtr, Coord3D.getCPtr(arg0)); if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve(); return ret; }
public Coord3D(Coord3D coord, int x = 0, int y = 0, int z = 0) { this.x = coord.x + x; this.y = coord.y + y; this.z = coord.z + z; }
public bool Not(Coord3D c) { bool ret = VisionLabPINVOKE.Coord3D_Not(swigCPtr, Coord3D.getCPtr(c)); if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve(); return ret; }