static Vector3S() { Up = new Vector3S(0, 1, 0); Down = new Vector3S(0, -1, 0); Right = new Vector3S(1, 0, 0); Left = new Vector3S(-1, 0, 0); Forward = new Vector3S(0, 0, -1); Backward = new Vector3S(0, 0, 1); }
public Vector3I(Vector3S xyz) { X = (int)xyz.X; Y = (int)xyz.Y; Z = (int)xyz.Z; }
public Vector3L(Vector3S xyz) { this.X = xyz.X; this.Y = xyz.Y; this.Z = xyz.Z; }
// Iterate over sector boxes in a range. private void ForEachSector(Vector3 localPosition, float range, SectorIteration iterator) { Vector3 sectorPosition; LocalPositionToSectorCube(localPosition, out sectorPosition); Vector3D referencePoint = localPosition; SectorScans.Hit(); Vector3 rangev = new Vector3(range); BoundingBox probe = new BoundingBox(sectorPosition - rangev, sectorPosition + rangev); BoundingBoxI inter = m_sectorBox.Intersect(probe); Vector3S min = new Vector3S(inter.Min); Vector3S max = new Vector3S(inter.Max); // Iterate over each face of the cube that is in the intersection. MyPlanetSectorId id = new MyPlanetSectorId(); // Front if (inter.Min.Z == m_sectorBox.Min.Z) { id.Direction = Vector3B.Backward; id.Position.Z = min.Z; for (id.Position.X = min.X; id.Position.X <= max.X; id.Position.X++) for (id.Position.Y = min.Y; id.Position.Y <= max.Y; id.Position.Y++) iterator(this, ref id, ref referencePoint); } // Back if (inter.Max.Z == m_sectorBox.Max.Z) { id.Direction = Vector3B.Forward; id.Position.Z = max.Z; for (id.Position.X = min.X; id.Position.X <= max.X; id.Position.X++) for (id.Position.Y = min.Y; id.Position.Y <= max.Y; id.Position.Y++) iterator(this, ref id, ref referencePoint); } // Right if (inter.Min.X == m_sectorBox.Min.X) { id.Direction = Vector3B.Right; id.Position.X = min.X; for (id.Position.Y = min.Y; id.Position.Y <= max.Y; id.Position.Y++) for (id.Position.Z = min.Z; id.Position.Z <= max.Z; id.Position.Z++) iterator(this, ref id, ref referencePoint); } // Left if (inter.Max.X == m_sectorBox.Max.X) { id.Direction = Vector3B.Left; id.Position.X = max.X; for (id.Position.Y = min.Y; id.Position.Y <= max.Y; id.Position.Y++) for (id.Position.Z = min.Z; id.Position.Z <= max.Z; id.Position.Z++) iterator(this, ref id, ref referencePoint); } // Up if (inter.Min.Y == m_sectorBox.Min.Y) { id.Direction = Vector3B.Up; id.Position.Y = min.Y; for (id.Position.X = min.X; id.Position.X <= max.X; id.Position.X++) for (id.Position.Z = min.Z; id.Position.Z <= max.Z; id.Position.Z++) iterator(this, ref id, ref referencePoint); } // Down if (inter.Max.Y == m_sectorBox.Max.Y) { id.Direction = Vector3B.Down; id.Position.Y = max.Y; for (id.Position.X = min.X; id.Position.X <= max.X; id.Position.X++) for (id.Position.Z = min.Z; id.Position.Z <= max.Z; id.Position.Z++) iterator(this, ref id, ref referencePoint); } }