public PolylinePointD3D WithPosition(PointD3D position) { var result = this; result.Position = position; return(result); }
public static void Test_GetPolylinePointsWithWestAndNorth_02() { const double maxDev = 1E-6; var rnd = new System.Random(); var testPoints = new PointD3D[1024]; testPoints[0] = PointD3D.Empty; testPoints[1] = new PointD3D(0, 0.1, 0); // first line segment always in y direction, so that north is in z direction and west in -x direction for (int i = 2; i < testPoints.Length; ++i) { testPoints[i] = new PointD3D(rnd.NextDouble(), rnd.NextDouble(), rnd.NextDouble()); } var result = PolylineMath3D.GetPolylinePointsWithWestAndNorth(testPoints).ToArray(); for (int i = 1; i < result.Length; ++i) { var forwardRaw = result[i].Position - result[i - 1].Position; var west = result[i].WestVector; var north = result[i].NorthVector; Assert.AreNotEqual(forwardRaw.Length, 0); // GetPolylinePointsWithWestAndNorth should only deliver non-empty segments var forward = forwardRaw.Normalized; Assert.AreEqual(west.Length, 1, maxDev); // is west normalized Assert.AreEqual(north.Length, 1, maxDev); // is north normalized Assert.AreEqual(VectorD3D.DotProduct(west, forward), 0, maxDev); // is west perpendicular to forward Assert.AreEqual(VectorD3D.DotProduct(north, forward), 0, maxDev); // is north perpendicular to forward Assert.AreEqual(VectorD3D.DotProduct(west, north), 0, maxDev); // is west perpendicular to north var matrix = Altaxo.Geometry.Matrix4x3.NewFromBasisVectorsAndLocation(west, north, forward, PointD3D.Empty); Assert.AreEqual(matrix.Determinant, 1, maxDev); // west-north-forward are a right handed coordinate system } }
public PolylinePointD3DAsClass(VectorD3D forwardVector, VectorD3D westVector, VectorD3D northVector, PointD3D position) { Position = position; WestVector = westVector; NorthVector = northVector; ForwardVector = forwardVector; }
/// <summary> /// Expands this rectangle, so that it contains the point p. /// </summary> /// <param name="p">The point that should be contained in this rectangle.</param> /// <returns>The new rectangle that now contains the point p.</returns> private void ExpandToInclude(PointD3D p) { if (!(Contains(p))) { if (p.X < _x) { _sizeX += _x - p.X; _x = p.X; } else if (p.X > (_x + _sizeX)) { _sizeX = p.X - _x; } if (p.Y < _y) { _sizeY += _y - p.Y; _y = p.Y; } else if (p.Y > (_y + _sizeY)) { _sizeY = p.Y - _y; } if (p.Z < _z) { _sizeZ += _z - p.Z; _z = p.Z; } else if (p.Z > (_z + _sizeZ)) { _sizeZ = p.Z - _z; } } }
/// <summary> /// Creates a transformation matrix that projects 2D points (in fact: 3D-points with ignored z-coordinate) to a plane that is defined by 2 vectors (<paramref name="e"/> and <paramref name="n"/>) and a point /// on that plane <paramref name="p"/>. The x-coordinates of the original point is projected in the <paramref name="e"/> direction, the y-coordinate in the <paramref name="n"/> direction. /// </summary> /// <param name="e">East vector: direction, in which the x-coordinate of the original points is projected.</param> /// <param name="n">North vector: direction, in which the y-coordinate of the original points is projected.</param> /// <param name="p">The 3D point, which is the origin of the spanned plane (the original point with the coordinates (0,0) is projected to this point.</param> /// <returns>A transformation matrix that projects 2D points (in fact: 3D-points with ignored z-coordinate) to a plane in 3D space.</returns> public static Matrix4x3 Get2DProjectionToPlane(VectorD3D e, VectorD3D n, PointD3D p) { return(new Matrix4x3( e.X, e.Y, e.Z, n.X, n.Y, n.Z, 0, 0, 0, p.X, p.Y, p.Z)); }
public RectangleD3D(PointD3D position, VectorD3D size) { _x = position.X; _y = position.Y; _z = position.Z; _sizeX = size.X; _sizeY = size.Y; _sizeZ = size.Z; }
/// <summary> /// Inverse transform a point p in such a way that the result will fullfill the relation p = result * matrix ( the * operator being the prepend transformation for points). /// </summary> /// <param name="p">The point p to inverse transform.</param> /// <returns>The inverse transformation of point <paramref name="p"/>.</returns> public PointD3D InverseTransform(PointD3D p) { return(new PointD3D( (M23 * (M32 * (M41 - p.X) + M31 * (-M42 + p.Y)) + M22 * (-(M33 * M41) + M31 * M43 + M33 * p.X - M31 * p.Z) + M21 * (M33 * M42 - M32 * M43 - M33 * p.Y + M32 * p.Z)) / Determinant, (M13 * (M32 * (-M41 + p.X) + M31 * (M42 - p.Y)) + M12 * (M33 * M41 - M31 * M43 - M33 * p.X + M31 * p.Z) + M11 * (-(M33 * M42) + M32 * M43 + M33 * p.Y - M32 * p.Z)) / Determinant, (M13 * (M22 * (M41 - p.X) + M21 * (-M42 + p.Y)) + M12 * (-(M23 * M41) + M21 * M43 + M23 * p.X - M21 * p.Z) + M11 * (M23 * M42 - M22 * M43 - M23 * p.Y + M22 * p.Z)) / Determinant )); }
/// <summary> /// Transforms the specified point <paramref name="p"/>. For a point transform, the offset elements M41..M43 are used. /// The transformation is carried out as a prepend transformation, i.e. result = p * matrix (p considered as horizontal vector). /// </summary> /// <param name="p">The point to transform.</param> /// <returns>The transformed point.</returns> public PointD3D Transform(PointD3D p) { double x = p.X; double y = p.Y; double z = p.Z; return(new PointD3D( x * M11 + y * M21 + z * M31 + M41, x * M12 + y * M22 + z * M32 + M42, x * M13 + y * M23 + z * M33 + M43 )); }
/// <summary> /// Gets a projection matrix that projects a point in the direction given by <paramref name="v"/> onto a plane with is given by an arbitrary point on the plane <paramref name="p"/> and the plane's normal <paramref name="q"/>. /// </summary> /// <param name="v">The projection direction. Not required to be normalized.</param> /// <param name="p">An arbitrary point onto the projection plane.</param> /// <param name="q">The projection plane's normal. Not required to be normalized.</param> /// <returns>The projection matrix that projects a point in the direction given by <paramref name="v"/> onto a plane with is given by an arbitrary point on the plane <paramref name="p"/> and the plane's normal <paramref name="q"/>.</returns> public static Matrix4x3 GetProjectionToPlane(VectorD3D v, PointD3D p, VectorD3D q) { double OneByQV = 1 / VectorD3D.DotProduct(q, v); double DotPQ = p.X * q.X + p.Y * q.Y + p.Z * q.Z; return(new Matrix4x3( 1 - q.X * v.X * OneByQV, -q.X * v.Y * OneByQV, -q.X * v.Z * OneByQV, -q.Y * v.X * OneByQV, 1 - q.Y * v.Y * OneByQV, -q.Y * v.Z * OneByQV, -q.Z * v.X * OneByQV, -q.Z * v.Y * OneByQV, 1 - q.Z * v.Z * OneByQV, DotPQ * v.X * OneByQV, DotPQ * v.Y * OneByQV, DotPQ * v.Z * OneByQV )); }
/// <summary> /// Transforms the specified point <paramref name="p"/>. For a point transform, the offset elements M41..M43 are used. /// The transformation is carried out as a prepend transformation, i.e. result = p * matrix (p considered as horizontal vector). /// </summary> /// <param name="p">The point to transform.</param> /// <returns>The transformed point.</returns> public PointD3D Transform(PointD3D p) { double x = p.X; double y = p.Y; double z = p.Z; double tw = x * M14 + y * M24 + z * M34 + M44; return(new PointD3D( (x * M11 + y * M21 + z * M31 + M41) / tw, (x * M12 + y * M22 + z * M32 + M42) / tw, (x * M13 + y * M23 + z * M33 + M43) / tw )); }
/// <summary> /// Gets the relative positions of the two points on a line segment that have a given distance to a third point. The returned relative values are in the range [-Infinity, Infinity] and /// therefore don't neccessarily lie directly on the line segment. Furthermore, a solution not always exists (in this case the returned values are NaN). /// </summary> /// <param name="p0">The start point of the line segment..</param> /// <param name="p1">The end point of the line segment.</param> /// <param name="ps">The third point.</param> /// <param name="distance">The distance between a point on the line sigment and the third point.</param> /// <returns>The relative positions of the points on the line segment that have the provided distance to the third point. The returned relative values are in the range [-Infinity, Infinity] and /// therefore don't neccessarily lie directly on the line segment. Furthermore, a solution not always exists (in this case the returned values are NaN). </returns> public static Tuple <double, double> GetRelativePositionsOnLineSegmentForPointsAtDistanceToPoint(PointD3D p0, PointD3D p1, PointD3D ps, double distance) { // we rescale the problem so that p0 is becoming the origin p1 = new PointD3D(p1.X - p0.X, p1.Y - p0.Y, p1.Z - p0.Z); ps = new PointD3D(ps.X - p0.X, ps.Y - p0.Y, ps.Z - p0.Z); var p1Sq = p1.X * p1.X + p1.Y * p1.Y + p1.Z * p1.Z; var psSq = ps.X * ps.X + ps.Y * ps.Y + ps.Z * ps.Z; var p1ps = p1.X * ps.X + p1.Y * ps.Y + p1.Z * ps.Z; var squareRootTerm = Math.Sqrt(p1ps * p1ps - p1Sq * (psSq - distance * distance)); var t1 = (p1ps - squareRootTerm) / p1Sq; var t2 = (p1ps + squareRootTerm) / p1Sq; return(new Tuple <double, double>(t1, t2)); }
/// <summary> /// Gets a sharp polyline from a point array which may contain consecutive dublettes, i.e. two or more consecutive points with equal coordinates. /// </summary> /// <param name="points">The points.</param> /// <returns>An instance of <see cref="SharpPolylineD3D"/>, free from consecutive dublettes. Attention: the number of points in this polyline may differ from /// the number of points that were provided!</returns> public static SharpPolylineD3D FromPointsWithPossibleDublettes(IEnumerable <PointD3D> points) { var mypoints = new List <PointD3D>(); if (null != points) { PointD3D prevPoint = PointD3D.Empty; foreach (var point in points) { if (point != prevPoint || mypoints.Count == 0) { mypoints.Add(point); } prevPoint = point; } } return(new SharpPolylineD3D(mypoints.ToArray())); }
public IPolylineD3D ShortenedBy(RADouble marginAtStart, RADouble marginAtEnd) { if (_points.Length < 2) { return(null); } double totLength = TotalLineLength; double a1 = marginAtStart.IsAbsolute ? marginAtStart.Value : marginAtStart.Value * totLength; double a2 = marginAtEnd.IsAbsolute ? marginAtEnd.Value : marginAtEnd.Value * totLength; if (!((a1 + a2) < totLength)) { return(null); } PointD3D?p0 = null; PointD3D?p1 = null; int i0 = 0; int i1 = 0; if (a1 <= 0) { p0 = PointD3D.Interpolate(_points[0], _points[1], a1 / totLength); i0 = 1; } else { double sum = 0, prevSum = 0; for (int i = 1; i < _points.Length; ++i) { sum += (_points[i] - _points[i - 1]).Length; if (!(sum < a1)) { p0 = PointD3D.Interpolate(_points[i - 1], _points[i], (a1 - prevSum) / (sum - prevSum)); i0 = p0 != _points[i] ? i : i + 1; break; } prevSum = sum; } } if (a2 <= 0) { p1 = PointD3D.Interpolate(_points[_points.Length - 2], _points[_points.Length - 1], 1 - a2 / totLength); i1 = _points.Length - 2; } else { double sum = 0, prevSum = 0; for (int i = _points.Length - 2; i >= 0; --i) { sum += (_points[i] - _points[i + 1]).Length; if (!(sum < a2)) { p1 = PointD3D.Interpolate(_points[i + 1], _points[i], (a2 - prevSum) / (sum - prevSum)); i1 = p1 != _points[i] ? i : i - 1; break; } prevSum = sum; } } if (p0.HasValue && p1.HasValue) { var plist = new List <PointD3D> { p0.Value }; for (int i = i0; i <= i1; ++i) { plist.Add(_points[i]); } plist.Add(p1.Value); return(new SharpPolylineD3D(plist.ToArray())); } else { return(null); } }
/// <summary> /// Initializes a new instance of the <see cref="LineD3D"/> struct. /// </summary> /// <param name="p0">The starting point of the line.</param> /// <param name="p1">The end point of the line.</param> public LineD3D(PointD3D p0, PointD3D p1) { _p0 = p0; _p1 = p1; }
/// <summary> /// Interpolates between the points <paramref name="p0"/> and <paramref name="p1"/>. /// </summary> /// <param name="p0">The first point.</param> /// <param name="p1">The second point.</param> /// <param name="r">Relative way between <paramref name="p0"/> and <paramref name="p1"/> (0..1).</param> /// <returns>Interpolation between <paramref name="p0"/> and <paramref name="p1"/>. The return value is <paramref name="p0"/> if <paramref name="r"/> is 0. The return value is <paramref name="p1"/> if <paramref name="r"/> is 1. </returns> public static PointD3D Interpolate(PointD3D p0, PointD3D p1, double r) { double or = 1 - r; return(new PointD3D(or * p0.X + r * p1.X, or * p0.Y + r * p1.Y, or * p0.Z + r * p1.Z)); }
/// <summary> /// Returns a new line with <see cref="P1"/> set to the provided value. /// </summary> /// <param name="p1">The value for <see cref="P1"/>.</param> /// <returns>A new line with <see cref="P1"/> set to the provided value.</returns> public LineD3D WithP1(PointD3D p1) { return(new LineD3D(P0, p1)); }
/// <summary> /// Creates a transformation matrix that uses three basis vectors, and a location to construct the matrix that transform points expressed in the three basis vectors to points in /// the coordinate system. /// </summary> /// <param name="xBasis">Basis vector for the x-direction.</param> /// <param name="yBasis">Basis vector for the y-direction.</param> /// <param name="zBasis">Basis vector for the z-direction.</param> /// <param name="origin">The origin of the coordinate system.</param> /// <returns>A transformation matrix that uses the three basis vectors, and a location</returns> public static Matrix4x3 NewFromBasisVectorsAndLocation(VectorD3D xBasis, VectorD3D yBasis, VectorD3D zBasis, PointD3D origin) { return(new Matrix4x3( xBasis.X, xBasis.Y, xBasis.Z, yBasis.X, yBasis.Y, yBasis.Z, zBasis.X, zBasis.Y, zBasis.Z, origin.X, origin.Y, origin.Z)); }
public PointD3D TransformPoint(PointD3D p) { return(Transform(p)); }
/// <summary> /// Gets the fractional index of the point on a line that has a certain distance to another point <paramref name="ps"/>. /// </summary> /// <param name="p0">The start point of the line.</param> /// <param name="p1">The end point of the line.</param> /// <param name="ps">The other point.</param> /// <param name="distance">The given distance.</param> /// <returns>A relative index on the line [0..1] for the point on the line that has the provided distance to the point <paramref name="ps"/>. If the point <paramref name="ps"/> is too far away, the result will be double.NaN. /// If the point <paramref name="ps"/> is too close, the result can be outside the interval [0,1].</returns> public static double GetFractionalIndexOfPointOnLineInGivenDistanceToAnotherPoint(PointD3D p0, PointD3D p1, PointD3D ps, double distance) { VectorD3D p0s = p0 - ps; VectorD3D seg = p1 - ps; double dotps = VectorD3D.DotProduct(p0s, seg); double slen_p0s = p0s.SquareOfLength; double slen_seg = seg.SquareOfLength; double sqrt = Math.Sqrt(dotps * dotps + (distance * distance - slen_p0s) * slen_seg); double t1 = (-dotps - sqrt) / slen_seg; double t2 = (-dotps + sqrt) / slen_seg; return(t1 >= 0 ? t1 : t2); }
/// <summary> /// Creates the rotation matrix from axis and angle radian. /// </summary> /// <param name="u">The axis about which the rotation takes place.</param> /// <param name="angleRadian">The rotation angle in radian.</param> /// <param name="center">The center of rotation.</param> /// <returns>Matrix that describes the drotation.</returns> public static Matrix4x3 NewRotationFromAxisAndAngleRadian(VectorD3D u, double angleRadian, PointD3D center) { double cosTheta = Math.Cos(angleRadian); double oMCosTheta = 1 - cosTheta; double sinTheta = Math.Sin(angleRadian); double m11 = cosTheta + u.X * u.X * oMCosTheta; double m12 = u.X * u.Y * oMCosTheta + u.Z * sinTheta; double m13 = u.Z * u.X * oMCosTheta - u.Y * sinTheta; double m21 = u.X * u.Y * oMCosTheta - u.Z * sinTheta; double m22 = cosTheta + u.Y * u.Y * oMCosTheta; double m23 = u.Z * u.Y * oMCosTheta + u.X * sinTheta; double m31 = u.X * u.Z * oMCosTheta + u.Y * sinTheta; double m32 = u.Y * u.Z * oMCosTheta - u.X * sinTheta; double m33 = cosTheta + u.Z * u.Z * oMCosTheta; double offsetX = 0, offsetY = 0, offsetZ = 0; if (center.X != 0.0 || center.Y != 0.0 || center.Z != 0.0) { offsetX = -center.X * m11 - center.Y * m21 - center.Z * m31 + center.X; offsetY = -center.X * m12 - center.Y * m22 - center.Z * m32 + center.Y; offsetZ = -center.X * m13 - center.Y * m23 - center.Z * m33 + center.Z; } return(new Matrix4x3(m11, m12, m13, m21, m22, m23, m31, m32, m33, offsetX, offsetY, offsetZ)); }
/// <summary> /// Initializes a new instance of the <see cref="Ray3D"/> class. /// </summary> /// <param name="origin">The origin of the line (one arbitrary point at the line).</param> /// <param name="direction">The direction of the line.</param> public Ray3D(PointD3D origin, VectorD3D direction) { _origin = origin; _direction = direction; }
/// <summary> /// Gets the distance of a point <paramref name="a"/> to a plane defined by a point <paramref name="p"/> and a normal vector <paramref name="q"/>. The distance is considered to be positive /// if the point <paramref name="a"/> is located in the half space into which the vector <paramref name="q"/> is pointing. /// </summary> /// <param name="a">The point a.</param> /// <param name="p">A point on a plane.</param> /// <param name="q">The normal vector of that plane (can be not-normalized).</param> /// <returns></returns> public static double GetDistancePointToPlane(PointD3D a, PointD3D p, VectorD3D q) { return(((a.X - p.X) * q.X + (a.Y - p.Y) * q.Y + (a.Z - p.Z) * q.Z) / q.Length); }
/// <summary> /// Creates a transformation matrix that does the following: First, it converts a 2D point into a 3D coordinate system with the origin given by <paramref name="p"/>, and the unit vectors <paramref name="e"/> and <paramref name="n"/>. /// Then the thus created 3D point is projected in the direction of <paramref name="v"/> onto a plane that is defined by the same point <paramref name="p"/> on the plane and the plane's normal <paramref name="q"/>. /// </summary> /// <param name="e">East vector: Spans one dimension of the projection of the 2D points to a 3D plane.</param> /// <param name="n">North vector: Spans the other dimension of the projection of the 2D input points to a 3D plane.</param> /// <param name="v">Direction of the projection of the 3D points to a plane.</param> /// <param name="p">Origin of the coordinate system, and point on the projection plane, too.</param> /// <param name="q">Normal of the projection plane.</param> /// <returns>Matrix that transforms 2D points to a plane. (The 2D points are in fact 3D points with a z-coordinate that is ignored.</returns> public static Matrix4x3 Get2DProjectionToPlaneToPlane(VectorD3D e, VectorD3D n, VectorD3D v, PointD3D p, VectorD3D q) { double qn = VectorD3D.DotProduct(q, e); double qw = VectorD3D.DotProduct(q, n); double qv = VectorD3D.DotProduct(q, v); double qn_qv = qn / qv; double qw_qv = qw / qv; return(new Matrix4x3( e.X - v.X * qn_qv, e.Y - v.Y * qn_qv, e.Z - v.Z * qn_qv, n.X - v.X * qw_qv, n.Y - v.Y * qw_qv, n.Z - v.Z * qw_qv, 0, 0, 0, p.X, p.Y, p.Z)); }
public static void Test_GetFractionalPolyline_01() { const double maxDev = 1E-6; string comment = string.Empty; for (int caseNo = 0; caseNo < _testCases.Length; ++caseNo) { if (caseNo == 1 || caseNo == 2) // not with coincidenting points { continue; } var points = _testCases[caseNo].Item1; var expectedOutput = _testCases[caseNo].Item2; var maxEndIndex = points.Length - 1; for (double endIndex = 0.25; endIndex <= maxEndIndex; endIndex += 0.25) { for (double startIndex = 0; startIndex < endIndex; startIndex += 0.25) { var result = PolylineMath3D.GetPolylineWithFractionalStartAndEndIndex( points, expectedOutput[0].Item2, expectedOutput[0].Item3, (points[1] - points[0]).Normalized, startIndex, endIndex, false, false, new PolylinePointD3DAsClass(), false, false, new PolylinePointD3DAsClass()).ToArray(); int iShift = (int)Math.Floor(startIndex); for (int i = (int)Math.Ceiling(startIndex); i < (int)Math.Floor(endIndex); ++i) { comment = string.Format("In case no. {0}, startIndex={1}, endIndex={2}, i={3}", caseNo, startIndex, endIndex, i); Assert.AreEqual(expectedOutput[i].Item1, result[i - iShift].Position, comment); Assert.AreEqual(expectedOutput[i].Item2.X, result[i - iShift].WestVector.X, maxDev, comment); Assert.AreEqual(expectedOutput[i].Item2.Y, result[i - iShift].WestVector.Y, maxDev, comment); Assert.AreEqual(expectedOutput[i].Item2.Z, result[i - iShift].WestVector.Z, maxDev, comment); Assert.AreEqual(expectedOutput[i].Item3.X, result[i - iShift].NorthVector.X, maxDev, comment); Assert.AreEqual(expectedOutput[i].Item3.Y, result[i - iShift].NorthVector.Y, maxDev, comment); Assert.AreEqual(expectedOutput[i].Item3.Z, result[i - iShift].NorthVector.Z, maxDev, comment); } // start int startIndexInt = (int)Math.Floor(startIndex); double startIndexFrac = startIndex - startIndexInt; var expectedStartPoint = startIndexFrac == 0 ? points[startIndexInt] : PointD3D.Interpolate(points[startIndexInt], points[startIndexInt + 1], startIndexFrac); int vecIndex = startIndexFrac == 0 ? startIndexInt : startIndexInt + 1; comment = string.Format("In case no. {0}, startIndex={1}, endIndex={2}", caseNo, startIndex, endIndex); Assert.AreEqual(expectedStartPoint, result[0].Position, comment); Assert.AreEqual(expectedOutput[vecIndex].Item2.X, result[0].WestVector.X, maxDev, comment); Assert.AreEqual(expectedOutput[vecIndex].Item2.Y, result[0].WestVector.Y, maxDev, comment); Assert.AreEqual(expectedOutput[vecIndex].Item2.Z, result[0].WestVector.Z, maxDev, comment); Assert.AreEqual(expectedOutput[vecIndex].Item3.X, result[0].NorthVector.X, maxDev, comment); Assert.AreEqual(expectedOutput[vecIndex].Item3.Y, result[0].NorthVector.Y, maxDev, comment); Assert.AreEqual(expectedOutput[vecIndex].Item3.Z, result[0].NorthVector.Z, maxDev, comment); // end int endIndexInt = (int)Math.Floor(endIndex); double endIndexFrac = endIndex - endIndexInt; var expectedEndPoint = endIndexFrac == 0 ? points[endIndexInt] : PointD3D.Interpolate(points[endIndexInt], points[endIndexInt + 1], endIndexFrac); vecIndex = endIndexFrac == 0 ? endIndexInt : endIndexInt + 1; var resultLast = result[result.Length - 1]; Assert.AreEqual(expectedEndPoint, resultLast.Position, comment); Assert.AreEqual(expectedOutput[vecIndex].Item2.X, resultLast.WestVector.X, maxDev, comment); Assert.AreEqual(expectedOutput[vecIndex].Item2.Y, resultLast.WestVector.Y, maxDev, comment); Assert.AreEqual(expectedOutput[vecIndex].Item2.Z, resultLast.WestVector.Z, maxDev, comment); Assert.AreEqual(expectedOutput[vecIndex].Item3.X, resultLast.NorthVector.X, maxDev, comment); Assert.AreEqual(expectedOutput[vecIndex].Item3.Y, resultLast.NorthVector.Y, maxDev, comment); Assert.AreEqual(expectedOutput[vecIndex].Item3.Z, resultLast.NorthVector.Z, maxDev, comment); // test first returned } } } }
public RectangleD3D WithLocation(PointD3D newLocation) { return(new RectangleD3D(newLocation.X, newLocation.Y, newLocation.Z, SizeX, SizeY, SizeZ)); }
/// <summary> /// Returns a new line with <see cref="P0"/> set to the provided value. /// </summary> /// <param name="p0">The value for <see cref="P0"/>.</param> /// <returns>A new line with <see cref="P0"/> set to the provided value.</returns> public LineD3D WithP0(PointD3D p0) { return(new LineD3D(p0, P1)); }
public bool Contains(PointD3D p) { return(p.X >= X && p.Y >= Y && p.Z >= Z && p.X <= (_x + _sizeX) && p.Y <= (_y + _sizeY) && p.Z <= (_z + _sizeZ)); }