Exemple #1
0
        static public Glulam CreateGlulam(Beam beam, CrossSectionOrientation orientation, Standards.Standard standard = Standards.Standard.None)
        {
            Glulam glulam;

            if (beam.Centreline.IsLinear(Tolerance))
            {
                glulam = new StraightGlulam {
                    Centreline = beam.Centreline.DuplicateCurve(), Orientation = orientation, Data = new GlulamData()
                };
                glulam.Data.Compute(beam, standard);
            }
            else if (beam.Centreline.IsPlanar(Tolerance))
            {
                glulam = new SingleCurvedGlulam {
                    Centreline = beam.Centreline.DuplicateCurve(), Orientation = orientation, Data = new GlulamData()
                };
                glulam.Data.Compute(beam, standard);
            }
            else
            {
                glulam = new DoubleCurvedGlulam {
                    Centreline = beam.Centreline.DuplicateCurve(), Orientation = orientation, Data = new GlulamData()
                };
                glulam.Data.Compute(beam, standard);
            }
            return(glulam);
        }
Exemple #2
0
 public SingleCurvedGlulam(Curve curve, CrossSectionOrientation orientation, GlulamData data) : base()
 {
     Data        = data.Duplicate();
     Orientation = orientation.Duplicate();
     Centreline  = curve.DuplicateCurve();
     //Centreline.Domain.MakeIncreasing();
 }
Exemple #3
0
        /// <summary>
        /// Join a glulam onto another one. Returns null if join is not possible.
        /// </summary>
        /// <param name="glulam"></param>
        /// <returns></returns>
        public Glulam Join(Glulam glulam)
        {
            Rhino.Geometry.Intersect.CurveIntersections ci;
            ci = Rhino.Geometry.Intersect.Intersection.CurveCurve(Centreline, glulam.Centreline, Tolerance, OverlapTolerance);
            if (ci.Count != 1)
            {
                return(null);
            }
            if (ci[0].IsOverlap)
            {
                return(null);
            }
            if (Math.Abs(Centreline.TangentAt(ci[0].ParameterA) * glulam.Centreline.TangentAt(ci[0].ParameterB)) < AngleTolerance)
            {
                return(null);
            }

            Curve[] NewCentreline = Curve.JoinCurves(new Curve[] { Centreline, glulam.Centreline });
            if (NewCentreline.Length != 1)
            {
                return(null);
            }

            CrossSectionOrientation NewOrientation = Orientation.Duplicate();

            NewOrientation.Join(glulam.Orientation);

            Glulam new_glulam = CreateGlulam(NewCentreline[0], NewOrientation, Data.Duplicate());

            new_glulam.Data.Samples = Data.Samples + glulam.Data.Samples;

            return(new_glulam);
        }
        public override CrossSectionOrientation[] Split(IList <double> t)
        {
            CrossSectionOrientation[] new_orientations = new CrossSectionOrientation[t.Count + 1];
            for (int i = 0; i < new_orientations.Length; ++i)
            {
                new_orientations[i] = this.Duplicate();
            }

            return(new_orientations);
        }
        public override CrossSectionOrientation Join(CrossSectionOrientation orientation)
        {
            if (orientation is VectorListOrientation)
            {
                VectorListOrientation vlo  = orientation as VectorListOrientation;
                VectorParameter[]     temp = new VectorParameter[m_guides.Length + vlo.m_guides.Length];
                Array.Copy(m_guides, temp, m_guides.Length);
                Array.Copy(vlo.m_guides, 0, temp, m_guides.Length, vlo.m_guides.Length);
                Array.Sort(temp, (a, b) => a.Parameter.CompareTo(b.Parameter));

                m_guides = temp;
            }

            return(this.Duplicate());
        }
Exemple #6
0
        static public Glulam CreateGlulam(Curve curve, CrossSectionOrientation orientation, GlulamData data)
        {
            Glulam glulam;

            if (curve.IsLinear(Tolerance))
            {
                glulam = new StraightGlulam {
                    Centreline = curve.DuplicateCurve(), Orientation = orientation, Data = data.Duplicate()
                };
            }
            else if (curve.IsPlanar(Tolerance))
            {
                /*
                 * if (data.NumHeight < 2)
                 * {
                 *  data.Lamellae.ResizeArray(data.NumWidth, 2);
                 *  data.LamHeight /= 2;
                 * }
                 */
                glulam = new SingleCurvedGlulam {
                    Centreline = curve.DuplicateCurve(), Orientation = orientation, Data = data.Duplicate()
                };
            }
            else
            {
                /*
                 * if (data.NumHeight < 2)
                 * {
                 *  data.Lamellae.ResizeArray(data.NumWidth, 2);
                 *  data.LamHeight /= 2;
                 * }
                 *
                 * if (data.NumWidth < 2)
                 * {
                 *  data.Lamellae.ResizeArray(2, data.NumHeight);
                 *  data.LamWidth /= 2;
                 * }
                 */

                //glulam = new DoubleCurvedGlulam(curve, orientation, data);
                glulam = new DoubleCurvedGlulam {
                    Centreline = curve.DuplicateCurve(), Orientation = orientation, Data = data.Duplicate()
                };
            }

            return(glulam);
        }
Exemple #7
0
        public Glulam Trim(Interval domain, double overlap)
        {
            double l1 = Centreline.GetLength(new Interval(Centreline.Domain.Min, domain.Min));
            double l2 = Centreline.GetLength(new Interval(Centreline.Domain.Min, domain.Max));
            double t1, t2;

            if (!Centreline.LengthParameter(l1 - overlap, out t1))
            {
                t1 = domain.Min;
            }
            if (!Centreline.LengthParameter(l2 + overlap, out t2))
            {
                t2 = domain.Max;
            }

            domain = new Interval(
                Math.Max(t1, Centreline.Domain.Min),
                Math.Min(t2, Centreline.Domain.Max));

            double length = Centreline.GetLength(domain);

            if (domain.IsDecreasing || length < overlap || length < Glulam.OverlapTolerance)
            {
                return(null);
            }

            double percentage = length / Centreline.GetLength();

            GlulamData data = Data.Duplicate();

            data.Samples = Math.Max(6, (int)(data.Samples * percentage));


            Curve trimmed_curve = Centreline.Trim(domain);

            CrossSectionOrientation trimmed_orientation = Orientation.Trim(domain);

            trimmed_orientation.Remap(Centreline, trimmed_curve);

            Glulam glulam = CreateGlulam(trimmed_curve, trimmed_orientation, data);

            return(glulam);
        }
 public override CrossSectionOrientation Join(CrossSectionOrientation orientation)
 {
     return(this.Duplicate());
 }
 public abstract CrossSectionOrientation Join(CrossSectionOrientation orientation);
        public override CrossSectionOrientation[] Split(IList <double> t)
        {
            CrossSectionOrientation[] new_orientations = new CrossSectionOrientation[t.Count + 1];

            if (t.Count < 1)
            {
                new_orientations[0] = this.Duplicate();
                return(new_orientations);
            }

            int    prev       = 0;
            double prev_param = 0.0;
            bool   flag       = false;

            VectorParameter[] new_guides;

            int index = 0;

            foreach (double param in t)
            {
                int res = Array.BinarySearch(m_guides, param);

                if (res < 0)
                {
                    res = ~res;

                    new_guides = new VectorParameter[res - prev + 1];
                    Array.Copy(m_guides, prev, new_guides, 0, res - prev);

                    new_guides[new_guides.Length - 1] = new VectorParameter {
                        Parameter = param, Direction = GetOrientation(m_curve, param)
                    };
                    new_guides[new_guides.Length - 1].CalculateAngularOffset(m_curve);

                    if (prev > 0 || flag)
                    {
                        VectorParameter[] temp = new VectorParameter[new_guides.Length + 1];
                        temp[0] = new VectorParameter {
                            Parameter = prev_param, Direction = GetOrientation(m_curve, prev_param)
                        };
                        temp[0].CalculateAngularOffset(m_curve);

                        Array.Copy(new_guides, 0, temp, 1, new_guides.Length);
                        new_guides = temp;
                    }

                    new_orientations[index] = new VectorListOrientation(
                        m_curve,
                        new_guides);

                    prev_param = param;
                    prev       = res;
                    flag       = true;
                }
                else
                {
                    new_guides = new VectorParameter[res - prev + 1];
                    Array.Copy(m_guides, prev, new_guides, 0, res - prev + 1);

                    new_orientations[index] = new VectorListOrientation(
                        m_curve,
                        new_guides);

                    prev = res;
                }

                index++;
            }

            new_guides = new VectorParameter[m_guides.Length - prev + 1];
            Array.Copy(m_guides, prev, new_guides, 1, m_guides.Length - prev);

            new_guides[0] = new VectorParameter {
                Parameter = t.Last(), Direction = GetOrientation(m_curve, t.Last())
            };
            new_guides[0].CalculateAngularOffset(m_curve);

            new_orientations[index] = new VectorListOrientation(
                m_curve,
                new_guides);

            return(new_orientations);
        }
 public override CrossSectionOrientation Join(CrossSectionOrientation orientation)
 {
     throw new NotImplementedException();
 }