Skip to content

Commit

Permalink
Merge pull request #19 from Paramdigma/feature/nurbs
Browse files Browse the repository at this point in the history
Extra testing
  • Loading branch information
AlanRynne authored Nov 21, 2020
2 parents 14c79fd + c3cd138 commit 36146cf
Show file tree
Hide file tree
Showing 36 changed files with 466 additions and 300 deletions.
22 changes: 0 additions & 22 deletions .travis.yml

This file was deleted.

11 changes: 6 additions & 5 deletions src/Collections/Matrix{T}.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ public class Matrix<T>
/// <param name="column">Column.</param>
public ref T this[int row, int column] => ref this.data[row, column];

/// <summary>
/// Gets the amount of items in this matrix.
/// </summary>
public int Count => this.data.Length;


/// <summary>
/// Get the row of a matrix at the specified index.
Expand Down Expand Up @@ -86,11 +91,7 @@ public T[] Column(int m)
return col;
}

/// <summary>
/// Gets the amount of items in this matrix.
/// </summary>
public int Count => this.data.Length;


// ----- ORDERING METHODS -----


Expand Down
16 changes: 9 additions & 7 deletions src/Geometry/2D/BoundingBox2d.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public class BoundingBox2d
{
/// <summary>
/// Initializes a new instance of the <see cref="BoundingBox2d" /> class from 2 points.
/// Coordinates will automatically be corrected if the corners are not consistent with naming (i.e. bottomLeftCorner is actually topLeft..)
/// </summary>
/// <param name="bottomLeftCorner">Bottom left corner.</param>
/// <param name="topRightCorner">Top right corner.</param>
Expand Down Expand Up @@ -90,23 +91,23 @@ public BoundingBox2d(Polyline2d polyline)
public Point2d TopRight => new Point2d(this.XDomain.End, this.YDomain.End);

/// <summary>
/// Gets the midpoint at the left edge of the box.
/// Gets the midpoint at the left edge of the box.
/// </summary>
public Point2d MidLeft => new Point2d(this.XDomain.Start, this.YDomain.RemapFromUnit(0.5));

/// <summary>
/// Gets the midpoint at the right edge of the box.
/// Gets the midpoint at the right edge of the box.
/// </summary>
public Point2d MidRight => new Point2d(this.XDomain.End, this.YDomain.RemapFromUnit(0.5));

/// <summary>
/// Gets the midpoint at the bottom edge of the box.
/// Gets the midpoint at the bottom edge of the box.
/// </summary>
public Point2d MidBottom =>
new Point2d(this.XDomain.RemapFromUnit(0.5), this.YDomain.Start);

/// <summary>
/// Gets the midpoint at the top edge of the box.
/// Gets the midpoint at the top edge of the box.
/// </summary>
public Point2d MidTop => new Point2d(this.XDomain.RemapFromUnit(0.5), this.YDomain.End);

Expand All @@ -116,17 +117,18 @@ public BoundingBox2d(Polyline2d polyline)
public Point2d Center =>
new Point2d(this.XDomain.RemapFromUnit(0.5), this.YDomain.RemapFromUnit(0.5));


/// <summary>
/// Checks if a point is contained inside the box.
/// Checks if a point is contained inside the box.
/// </summary>
/// <param name="pt">Point to test containment.</param>
/// <returns>True if point is contained inside the bounding box.</returns>
public bool ContainsPoint(Point2d pt) =>
this.XDomain.Contains(pt.X) && this.YDomain.Contains(pt.Y);


/// <summary>
/// Checks if a box intersects with this instance.
/// Checks if a box intersects with this instance.
/// </summary>
/// <param name="box">Box to check intersection against.</param>
/// <returns>True if intersection exists.</returns>
Expand Down
13 changes: 2 additions & 11 deletions src/Geometry/2D/Polyline2d.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,7 @@ public Polyline2d(List<Point2d> vertices, bool closed)
/// Gets or sets the polyline vertices.
/// </summary>
/// <value>List of vertices.</value>
public List<Point2d> Vertices
{
get => this.vertices;

set
{
this.vertices = value;
this.segmentsNeedUpdate = true;
}
}
public List<Point2d> Vertices => this.vertices;

/// <summary>
/// Gets the polyline segments.
Expand Down Expand Up @@ -153,7 +144,7 @@ public bool IsClockwise()
{
if (this.vertices[i].Y > ymin)
continue;

if (Math.Abs(this.vertices[i].Y - ymin) < Settings.Tolerance
&& this.vertices[i].X < xmin)
continue;
Expand Down
11 changes: 6 additions & 5 deletions src/Geometry/3D/Circle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,23 @@
namespace Paramdigma.Core.Geometry
{
/// <summary>
/// Represents a planar circle curve.
/// Represents a planar circle curve.
/// </summary>
public class Circle : ICurve
{
/// <summary>
/// The base plane for the circle.
/// The base plane for the circle.
/// </summary>
public Plane Plane;

/// <summary>
/// The radius of the circle.
/// The radius of the circle.
/// </summary>
public double Radius;


/// <summary>
/// Initializes a new instance of <see cref="Circle"/> by it's plane and radius.
/// Initializes a new instance of <see cref="Circle" /> by it's plane and radius.
/// </summary>
/// <param name="plane">The plane to draw the circle at.</param>
/// <param name="radius">The desired radius of the circle.</param>
Expand Down
2 changes: 1 addition & 1 deletion src/Geometry/3D/Line.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public override Vector3d BinormalAt(double t) =>


/// <summary>
/// Explicitly converts a line to it's vector representation.
/// Explicitly converts a line to it's vector representation.
/// </summary>
/// <param name="line">Line to convert.</param>
/// <returns>Vector defining the line direction and length.</returns>
Expand Down
6 changes: 3 additions & 3 deletions src/Geometry/3D/Mesh/Mesh.cs
Original file line number Diff line number Diff line change
Expand Up @@ -484,10 +484,10 @@ private bool CreateFaces(IEnumerable<List<int>> faceIndexes)
boundaryHalfEdge.Vertex = nextHalfEdge.Vertex;
boundaryHalfEdge.Edge = halfEdge.Edge;
boundaryHalfEdge.OnBoundary = true;

boundaryHalfEdge.Face = f;
f.HalfEdge = boundaryHalfEdge;

boundaryHalfEdge.Twin = halfEdge;
halfEdge.Twin = boundaryHalfEdge;

Expand All @@ -506,7 +506,7 @@ private bool CreateFaces(IEnumerable<List<int>> faceIndexes)

if (h.OnBoundary)
continue;

var corner = new MeshCorner {HalfEdge = h};
h.Corner = corner;
this.Corners.Add(corner);
Expand Down
4 changes: 4 additions & 0 deletions src/Geometry/3D/Mesh/MeshTopology.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ public MeshTopology(Mesh mesh)
this.EdgeVertex = new Dictionary<int, List<int>>();
this.EdgeFace = new Dictionary<int, List<int>>();
this.EdgeEdge = new Dictionary<int, List<int>>();

this.ComputeEdgeAdjacency();
this.ComputeFaceAdjacency();
this.ComputeVertexAdjacency();
}


Expand Down
Loading

0 comments on commit 36146cf

Please sign in to comment.