Skip to content

Commit

Permalink
Merge branch 'FriendsOfCADability:master' into fix/Projection-SetPlac…
Browse files Browse the repository at this point in the history
…ement
  • Loading branch information
FreyLuis authored Dec 12, 2024
2 parents f8152cc + 7b852d5 commit 61990c1
Show file tree
Hide file tree
Showing 55 changed files with 732 additions and 606 deletions.
8 changes: 4 additions & 4 deletions CADability/BSpline.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ public class BSpline : IGeoObjectImpl, IColorDef, ILineWidth, ILinePattern, ISer
private GeoPoint[] interpol; // Interpolation mit einer gewissen Genauigkeit
private GeoVector[] interdir; // Interpolation mit einer gewissen Genauigkeit
private double[] interparam; // die Parameter zur Interpolation
private double maxInterpolError; // der größte Fehler bei der Interpolation
private BoundingCube extent;
private TetraederHull tetraederHull;
private GeoPoint[] approximation; // Interpolation mit der Genauigkeit der Auflösung
Expand Down Expand Up @@ -517,7 +516,6 @@ private void InvalidateSecondaryData()
interdir = null;
interparam = null;
approximation = null;
maxInterpolError = 0.0;
extent = BoundingCube.EmptyBoundingCube;
tetraederHull = null;
extrema = null;
Expand Down Expand Up @@ -551,7 +549,6 @@ public Changing(BSpline bSpline, bool keepNurbs)
bSpline.interpol = null;
bSpline.interdir = null;
bSpline.interparam = null;
bSpline.maxInterpolError = 0.0;
if (!keepNurbs)
{
bSpline.nubs3d = null;
Expand Down Expand Up @@ -3085,6 +3082,9 @@ CADability.Curve2D.ICurve2D ICurve.GetProjectedCurve(Plane p)
if (throughPoints2d.Count < 2)
{
return new Line2D(p.Project((this as ICurve).StartPoint), p.Project((this as ICurve).EndPoint));

//Unreachable code
/*
return null;
double prec = this.GetExtent(Precision.eps).Size * 1e-4;
ICurve approx = (this as ICurve).Approximate(false, prec);
Expand All @@ -3095,7 +3095,7 @@ CADability.Curve2D.ICurve2D ICurve.GetProjectedCurve(Plane p)
p2d.Reduce(prec); // vereinfacht den Pfad selbst, also res
if (p2d.SubCurvesCount == 1) return p2d.SubCurves[0];
}
return res;
return res;*/
}
}
try
Expand Down
28 changes: 19 additions & 9 deletions CADability/BSpline2D.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ private void MakeFlat()
knotslist.Add(knots[i]);
}
}

//Unreachable code
/*
if (false) // periodic ist nur eine Info, der Spline selbst ist doch immer geclampet, oder?
// if (periodic)
{
Expand All @@ -107,10 +110,14 @@ private void MakeFlat()
++secondknotindex;
}
}
*/

if (weights == null)
{
GeoPoint2D[] npoles;
if (false)

//Unreachable code
/* if (false)
//if (periodic)
{
npoles = new GeoPoint2D[poles.Length + degree];
Expand All @@ -131,22 +138,25 @@ private void MakeFlat()
//{ // das kommt bei STEP/piece0 z.B. vor, kommt ja nur über OpenCascade
// knotslist.Insert(0, knotslist[0]);
//}
}
else
{
}*/
//else
//{

npoles = new GeoPoint2D[poles.Length];
for (int i = 0; i < poles.Length; ++i)
{
npoles[i] = poles[i];
}
}
//}
this.nubs = new Nurbs<GeoPoint2D, GeoPoint2DPole>(degree, npoles, knotslist.ToArray());
nubs.InitDeriv1();
}
else
{
GeoPoint2DH[] npoles;
if (false)

//Unreachable code
/*if (false)
// if (periodic)
{
npoles = new GeoPoint2DH[poles.Length + degree];
Expand All @@ -161,13 +171,13 @@ private void MakeFlat()
// s.o.
}
else
{
{*/
npoles = new GeoPoint2DH[poles.Length];
for (int i = 0; i < poles.Length; ++i)
{
npoles[i] = new GeoPoint2DH(poles[i], weights[i]);
}
}
//}
this.nurbs = new Nurbs<GeoPoint2DH, GeoPoint2DHPole>(degree, npoles, knotslist.ToArray());
nurbs.InitDeriv1();
}
Expand Down Expand Up @@ -606,7 +616,7 @@ public BSpline2D(GeoPoint2D[] poles, double[] weights, double[] knots, int[] mul
{
Init();
}
catch (NurbsException ne)
catch (NurbsException)
{
}
// sollte durch Start/Endparameter nur ein Teilbereich des Splines gelten, dann
Expand Down
2 changes: 1 addition & 1 deletion CADability/Block.cs
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,7 @@ protected Block(SerializationInfo info, StreamingContext context)
name = (string)info.GetValue("Name", typeof(string));
// FinishDeserialization.AddToContext(context,this);
}
catch (SerializationException ex)
catch (SerializationException)
{
SerializationInfoEnumerator e = info.GetEnumerator();
while (e.MoveNext())
Expand Down
2 changes: 2 additions & 0 deletions CADability/Border.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3676,6 +3676,8 @@ internal Border[] RemoveConstrictions(double precision)
List<Border> res = new List<Border>();
double len = this.Extent.Size;
double leneps = len * precision;

//TODO: This doesn't make sense. Directly returning inside the for loop
for (int i = 0; i < segment.Length; i++)
{
ICollection cl = QuadTree.GetObjectsCloseTo(segment[i]);
Expand Down
Loading

0 comments on commit 61990c1

Please sign in to comment.