Skip to content

Commit

Permalink
Merge pull request #35 from oberbichler/fix/ds
Browse files Browse the repository at this point in the history
Fix ds
  • Loading branch information
oberbichler authored Mar 31, 2020
2 parents 54e4460 + b6bf141 commit 3470574
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 6 deletions.
17 changes: 17 additions & 0 deletions Bowerbird/CurveOnSurface/CurveOnSurface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -239,5 +239,22 @@ public IOrientableCurve Morph(SpaceMorph xmorph)
xmorph.Morph(surface);
return Create(surface, Curve);
}

public double Ds(double t)
{
var uv = Curve.DerivativeAt(t, 2);
var u = uv[0].X;
var v = uv[0].Y;
var u1 = uv[1].X;
var v1 = uv[1].Y;

Surface.Evaluate(u, v, 1, out var _, out var xyz);
var s10 = xyz[0];
var s01 = xyz[1];

var x1 = u1 * s10 + v1 * s01;

return x1.Length;
}
}
}
2 changes: 2 additions & 0 deletions Bowerbird/CurveOnSurface/IOrientableCurve.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ public interface IOrientableCurve

Vector3d TangentAt(double t);

double Ds(double t);

Vector3d NormalAt(double t);

Vector3d BinormalAt(double t);
Expand Down
12 changes: 6 additions & 6 deletions Bowerbird/CurveOnSurface/IntegrateComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ Func<double, double> Evaluate(IOrientableCurve curve, bool squared)
switch (ValueType)
{
case ValueTypes.NormalCurvature:
return o => curve.NormalCurvatureAt(o).Length;
return o => curve.NormalCurvatureAt(o).Length * curve.Ds(o);
case ValueTypes.GeodesicCurvature:
return o => curve.GeodesicCurvatureAt(o).Length;
return o => curve.GeodesicCurvatureAt(o).Length * curve.Ds(o);
case ValueTypes.GeodesicTorsion:
return o => curve.GeodesicTorsionAt(o).Length;
return o => curve.GeodesicTorsionAt(o).Length * curve.Ds(o);
default:
throw new Exception();
}
Expand All @@ -53,11 +53,11 @@ Func<double, double> Evaluate(IOrientableCurve curve, bool squared)
switch (ValueType)
{
case ValueTypes.NormalCurvature:
return o => curve.NormalCurvatureAt(o).SquareLength;
return o => curve.NormalCurvatureAt(o).SquareLength * curve.Ds(o);
case ValueTypes.GeodesicCurvature:
return o => curve.GeodesicCurvatureAt(o).SquareLength;
return o => curve.GeodesicCurvatureAt(o).SquareLength * curve.Ds(o);
case ValueTypes.GeodesicTorsion:
return o => curve.GeodesicTorsionAt(o).SquareLength;
return o => curve.GeodesicTorsionAt(o).SquareLength * curve.Ds(o);
default:
throw new Exception();
}
Expand Down
5 changes: 5 additions & 0 deletions Bowerbird/CurveOnSurface/ZeroTwistingCurve.cs
Original file line number Diff line number Diff line change
Expand Up @@ -190,5 +190,10 @@ public IOrientableCurve Morph(SpaceMorph xmorph)
xmorph.Morph(curve);
return Create(curve);
}

public double Ds(double t)
{
return Curve.DerivativeAt(t, 1)[1].Length;
}
}
}

0 comments on commit 3470574

Please sign in to comment.