Skip to content

Commit

Permalink
Fixes in nurbs derivatives + other tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
AlanRynne committed Nov 14, 2020
1 parent 2b06a01 commit f3dab85
Show file tree
Hide file tree
Showing 11 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/Geometry/3D/NurbsCalculator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ public static Point3d DeCasteljau2(
/// <returns>The knot span index.</returns>
public static int FindSpan(int n, int degree, double t, IList<double> knotVector)
{
if (Math.Abs(t - knotVector[n + 1]) < Settings.Tolerance)
if (t >= knotVector[n+1])
return n;

var low = degree;
Expand Down
4 changes: 2 additions & 2 deletions src/Geometry/3D/NurbsSurface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,10 @@ public Point3d PointAt(double u, double v) => NurbsCalculator.SurfacePoint(

public Matrix<Vector3d> DerivativesAt(double u, double v, int count) =>
NurbsCalculator.NurbsSurfaceDerivs(
this.ControlPoints.M,
this.ControlPoints.M - 1,
this.DegreeU,
this.KnotsU,
this.ControlPoints.M,
this.ControlPoints.M - 1,
this.DegreeV,
this.KnotsV,
this.ControlPoints,
Expand Down
2 changes: 1 addition & 1 deletion tests/Geometry/3D/BoxTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using Paramdigma.Core.Geometry;
using Xunit;

namespace Paramdigma.Core.Tests.Geometry._3D
namespace Paramdigma.Core.Tests.Geometry
{
public class BoxTests
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Geometry/3D/CircleTests.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Paramdigma.Core.Geometry;
using Xunit;

namespace Paramdigma.Core.Tests.Geometry._3D
namespace Paramdigma.Core.Tests.Geometry
{
public class CircleTests
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Geometry/3D/CylinderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using Paramdigma.Core.Geometry;
using Xunit;

namespace Paramdigma.Core.Tests.Geometry._3D
namespace Paramdigma.Core.Tests.Geometry
{
public class CylinderTests
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Geometry/3D/MeshTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using Paramdigma.Core.HalfEdgeMesh;
using Xunit;

namespace Paramdigma.Core.Tests.Geometry._3D
namespace Paramdigma.Core.Tests.Geometry
{
public class MeshTests
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Geometry/3D/MeshVertexTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using Paramdigma.Core.HalfEdgeMesh;
using Xunit;

namespace Paramdigma.Core.Tests.Geometry._3D
namespace Paramdigma.Core.Tests.Geometry
{
public class MeshVertexTests
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Geometry/3D/NurbsCurveData.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.Collections;
using System.Collections.Generic;

namespace Paramdigma.Core.Tests.Geometry._3D
namespace Paramdigma.Core.Tests.Geometry
{
public class NurbsCurveUnitParamData : IEnumerable<object[]>
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Geometry/3D/NurbsCurveTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using Xunit;
using RG = Rhino.Geometry;

namespace Paramdigma.Core.Tests.Geometry._3D
namespace Paramdigma.Core.Tests.Geometry
{
public class NurbsCurveTests
{
Expand Down
3 changes: 2 additions & 1 deletion tests/Geometry/3D/NurbsSurfaceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
using Xunit.Abstractions;
using RG = Rhino.Geometry;

namespace Paramdigma.Core.Tests.Geometry._3D
namespace Paramdigma.Core.Tests.Geometry
{
public class NurbsSurfaceTests
{
Expand Down Expand Up @@ -89,6 +89,7 @@ public IEnumerator<object[]> GetEnumerator()
yield return new object[] {0.8, .2};
yield return new object[] {0.9, .1};
yield return new object[] {0.99, .0};
yield return new object[] {1, .0};
}


Expand Down
2 changes: 1 addition & 1 deletion tests/Geometry/3D/SphereTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using Paramdigma.Core.Geometry;
using Xunit;

namespace Paramdigma.Core.Tests.Geometry._3D
namespace Paramdigma.Core.Tests.Geometry
{
public class SphereTests
{
Expand Down

0 comments on commit f3dab85

Please sign in to comment.