public override bool InKLimitsComponent(out bool width, out bool height) { width = height = false; double[] t = Centreline.DivideByCount(CurvatureSamples, false); double max_kw = 0.0, max_kh = 0.0; Plane temp; Vector3d k; for (int i = 0; i < t.Length; ++i) { temp = GetPlane(t[i]); k = Centreline.CurvatureAt(t[i]); max_kw = Math.Max(max_kw, Math.Abs(k * temp.XAxis)); max_kh = Math.Max(max_kh, Math.Abs(k * temp.YAxis)); } double rw = (1 / max_kw) / RadiusMultiplier; double rh = (1 / max_kh) / RadiusMultiplier; if (rw - Data.LamWidth > -RadiusTolerance || double.IsInfinity(1 / max_kw)) { width = true; } if (rh - Data.LamHeight > -RadiusTolerance || double.IsInfinity(1 / max_kh)) { height = true; } return(width && height); }
/// <summary> /// Checks the glulam to see if its lamella sizes are appropriate for its curvature. /// </summary> /// <param name="param">Parameter with maximum curvature.</param> /// <returns>True if glulam is within curvature limits.</returns> public bool InKLimits(out double param) { double[] t = Centreline.DivideByCount(CurvatureSamples, false); double max_k = 0.0; int index = 0; double temp; for (int i = 0; i < t.Length; ++i) { temp = Centreline.CurvatureAt(t[i]).Length; if (temp > max_k) { max_k = temp; index = i; } } param = t[index]; double ratio = (1 / max_k) / RadiusMultiplier; if (Math.Abs(ratio - Data.LamHeight) > RadiusTolerance || Math.Abs(ratio - Data.LamWidth) > RadiusTolerance) { return(false); } return(true); }
public override void CalculateLamellaSizes(double width, double height) { Plane cPlane; Centreline.TryGetPlane(out cPlane); var normal = cPlane.ZAxis; var tt = Centreline.DivideByCount(Data.Samples, true); double k = 0.0; Vector3d kVec; for (int i = 0; i < tt.Length; ++i) { kVec = Centreline.CurvatureAt(tt[i]); k = Math.Max(k, kVec.Length); } double lh = Math.Floor((1 / Math.Abs(k)) * Glulam.RadiusMultiplier); Data.LamWidth = width; int num_height = (int)Math.Ceiling(height / lh); Data.LamHeight = height / Data.LamHeight; if (num_height < 2) { num_height = 2; Data.LamHeight /= 2; } Data.Lamellae.ResizeArray(Data.NumWidth, num_height); }
public override void CalculateLamellaSizes(double width, double height) { var tt = Centreline.DivideByCount(Data.Samples, true); Plane kPlane; Vector3d kVec; double maxKX = 0.0, maxKY = 0.0; double dotKX, dotKY; for (int i = 0; i < tt.Length; ++i) { kPlane = GetPlane(tt[i]); kVec = Centreline.CurvatureAt(tt[i]); dotKX = kVec * kPlane.XAxis; dotKY = kVec * kPlane.YAxis; maxKX = Math.Max(dotKX, maxKX); maxKY = Math.Max(dotKY, maxKY); } double lh = Math.Floor((1 / Math.Abs(maxKY)) * Glulam.RadiusMultiplier); double lw = Math.Floor((1 / Math.Abs(maxKX)) * Glulam.RadiusMultiplier); int num_height = (int)Math.Ceiling(height / lh); Data.LamHeight = height / num_height; int num_width = (int)Math.Ceiling(width / lw); Data.LamWidth = width / num_width; if (Data.NumHeight < 2) { num_height = 2; Data.LamHeight /= 2; } if (Data.NumWidth < 2) { num_width = 2; Data.LamWidth /= 2; } Data.Lamellae.ResizeArray(num_width, num_height); }
public override double GetMaxCurvature(ref double width, ref double height) { double[] t = Centreline.DivideByCount(CurvatureSamples, false); double max_kw = 0.0, max_kh = 0.0, max_k = 0.0; Plane temp; Vector3d k; for (int i = 0; i < t.Length; ++i) { temp = GetPlane(t[i]); k = Centreline.CurvatureAt(t[i]); max_kw = Math.Max(max_kw, Math.Abs(k * temp.XAxis)); max_kh = Math.Max(max_kh, Math.Abs(k * temp.YAxis)); max_k = Math.Max(max_k, k.Length); } width = max_kw; height = max_kh; return(max_k); }