public bool HitsCircle(Circle3d circle, double tmin, double tmax, ref RayHit3d hit) { var dc = circle.Normal.Dot(Direction); var dw = circle.Normal.Dot(circle.Center - Origin); // If parallel to plane if (dc == 0.0) { return(false); } var t = dw / dc; if (!ComputeHit(t, tmin, tmax, ref hit)) { return(false); } if (V3d.Distance(hit.Point, circle.Center) > circle.Radius) { hit.Point = V3d.NaN; hit.T = tmax; return(false); } return(true); }
public Circle3d GetCircle(double height) { //circle along axis var dirLength = height; var radius = GetRadius(height); var dir = Direction.Normalized * dirLength; Circle3d circle = new Circle3d(Origin + dir, dir.Normalized, radius); return(circle); }
public ObliqueCone3d(V3d o, Circle3d c) { Origin = o; Circle = c; }
public Circle3d(Circle3d circle) { Center = circle.Center; Normal = circle.Normal; Radius = circle.Radius; }
public static bool ApproximateEquals(this Circle3d a, Circle3d b) => ApproximateEquals(a, b, Constant <double> .PositiveTinyValue);
public static bool ApproximateEquals(this Circle3d a, Circle3d b, double tolerance) => ApproximateEquals(a.Center, b.Center, tolerance) && ApproximateEquals(a.Normal, b.Normal, tolerance) && ApproximateEquals(a.Radius, b.Radius, tolerance);
public bool Equals(Circle3d other) => Center.Equals(other.Center) && Normal.Equals(other.Normal) && Radius.Equals(other.Radius);
public static ObliqueCone3d Parse(string s) { var x = s.NestedBracketSplitLevelOne().ToArray(); return(new ObliqueCone3d(V3d.Parse(x[0]), Circle3d.Parse(x[1]))); }