Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private static bool IsTangentConnected( Solid3D.Face face0, Solid3D.Face face1, Solid3D.Edge edge)
- {
- var angle = 1.5 / 180 * Math.PI;
- // Then the two faces share an edge.
- var surfaces0 = face0.Parametric;
- var surfaces1 = face1.Parametric;
- Vector3D Normal(Surface[] surfaces, Point3D p)
- {
- return surfaces
- .Select
- (s =>
- {
- // The below call to Project is very slow
- if (!s.Project(p, out var coord2D))
- throw new Exception("Unexpected");
- ;
- return (p: s.PointAt(coord2D), n: s.Normal(coord2D));
- })
- .MaxBy(q => p.DistanceTo(q.p))
- [0].n;
- }
- var pl = edge.Curve.PointAt(edge.Curve.Domain.Low);
- var pm = edge.Curve.PointAt(edge.Curve.Domain.Mid);
- var ph = edge.Curve.PointAt(edge.Curve.Domain.High);
- var vl0 = Normal(surfaces0, pl);
- var vl1 = Normal(surfaces1, pl);
- var vm0 = Normal(surfaces0, pm);
- var vm1 = Normal(surfaces1, pm);
- var vh0 = Normal(surfaces0, ph);
- var vh1 = Normal(surfaces1, ph);
- var r = Vector3D.AngleBetween(vl0, vl1) < angle
- && Vector3D.AngleBetween(vm0, vm1) < angle
- && Vector3D.AngleBetween(vh0, vh1) < angle;
- return r;
- }
Add Comment
Please, Sign In to add comment