Helper class to work with Voxels
More...
|
static IEnumerable< Vector3d > | WalkSurfaces (Segment segment, double deltaBias=0.002) |
| Walks the surfaces. Returns collision point on a surface of a voxel position More...
|
|
Helper class to work with Voxels
◆ WalkSurfaces()
static IEnumerable<Vector3d> pluginbase.Helpers.Geometry.Voxels.WalkSurfaces |
( |
Segment |
segment, |
|
|
double |
deltaBias = 0.002 |
|
) |
| |
|
static |
Walks the surfaces. Returns collision point on a surface of a voxel position
- Returns
- The surfaces.
- Parameters
-
segment | Segment. |
deltaBias | Delta bias. |
36 double segLength = segment.Length;
44 Vector3d sdir = segment.Direction;
45 Vector3d currVec = segment.Start;
46 double dx, dy, dz, mDelta, s;
47 dx = dy = dz =
double.MaxValue;
49 while(dist <= segLength)
54 s = Math.Sign(sdir.X);
56 dx = (Math.Ceiling( currVec.X + s ) - currVec.X) / sdir.X;
58 dx = (Math.Floor( currVec.X + s ) - currVec.X) / sdir.X;
63 s = Math.Sign(sdir.Y);
65 dy = (Math.Ceiling( currVec.Y + s ) - currVec.Y) / sdir.Y;
67 dy = (Math.Floor( currVec.Y + s ) - currVec.Y) / sdir.Y;
72 s = Math.Sign(sdir.Z);
74 dz = (Math.Ceiling( currVec.Z + s ) - currVec.Z) / sdir.Z;
76 dz = (Math.Floor( currVec.Z + s ) - currVec.Z) / sdir.Z;
80 mDelta = Min(dx, dy, dz) + deltaBias;
82 currVec += sdir * mDelta;
84 if (dist <= segLength)
The documentation for this class was generated from the following file: