Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed Curve and Surface into ExtendedMethods. #338

Merged
merged 2 commits into from
Sep 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions src/GShark/Core/CurveHelpers.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
using GShark.ExtendedMethods;
using GShark.Geometry;
using GShark.Operation;
using System.Collections.Generic;
using System.Linq;

namespace GShark.Core
{
internal static class CurveHelpers
{
/// <summary>
/// Normalizes knot vectors of all curves to the same domain.
/// </summary>
internal static IList<NurbsCurve> NormalizedKnots(IList<NurbsCurve> curves)
{
// Unify knots, normalized them.
curves = curves
.Select(curve => curve.Knots.GetDomain(curve.Degree).Length > 1
? new NurbsCurve(curve.Degree, curve.Knots.Normalize(), curve.ControlPoints)
: curve).ToList();

// Unify curves by knots.
KnotVector combinedKnots = curves.First().Knots.Copy();
foreach (NurbsCurve curve in curves.Skip(1))
{
combinedKnots.AddRange(curve.Knots.Where(k => !combinedKnots.Contains(k)).ToList());
}

curves = (from curve in curves
let knotToInsert = combinedKnots.OrderBy(k => k).Where(k => !curve.Knots.Contains(k)).ToKnot()
select Modify.CurveKnotRefine(curve, knotToInsert)).ToList();
return curves;
}

/// <summary>
/// Elevates degree of all curves to highest degree among all curves.
/// </summary>
internal static IList<NurbsCurve> NormalizedDegree(IList<NurbsCurve> curves)
{
// Unify curves by degree.
int targetDegree = curves.Max(c => c.Degree);
curves = curves
.Select(curve => curve.Degree != targetDegree
? Modify.ElevateDegree(curve, targetDegree)
: curve).ToList();

return curves;
}
}
}
239 changes: 0 additions & 239 deletions src/GShark/ExtendedMethods/Curve.cs

This file was deleted.

33 changes: 0 additions & 33 deletions src/GShark/ExtendedMethods/Surface.cs

This file was deleted.

Loading