Exemplo n.º 1
0
        public VBeamJoint(List <Element> elements, Factory.JointCondition jc) : base()
        {
            if (jc.Parts.Count != Parts.Length)
            {
                throw new Exception("VBeamJoint needs 3 elements.");
            }
            var c = jc.Parts[0].Case | (jc.Parts[1].Case << 1) | (jc.Parts[2].Case << 2);

            int[] indices;
            switch (c)
            {
            case (1):
                indices = new int[] { 1, 2, 0 };
                break;

            case (2):
                indices = new int[] { 0, 2, 1 };
                break;

            case (4):
                indices = new int[] { 0, 1, 2 };
                break;

            default:
                indices = new int[] { 0, 1, 2 };
                break;
            }

            for (int i = 0; i < Parts.Length; ++i)
            {
                Parts[i] = new JointPart(elements, jc.Parts[indices[i]], this);
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Creates a splice joint between two beam elements.
 /// </summary>
 /// <param name="elements">Array of two beam elements.</param>
 public SpliceJoint(Element[] elements) : base()
 {
     if (elements.Length != Parts.Length)
     {
         throw new Exception("SpliceJoint needs 2 elements.");
     }
     for (int i = 0; i < Parts.Length; ++i)
     {
         Parts[i] = new JointPart(elements[i] as BeamElement, this, i);
     }
 }
Exemplo n.º 3
0
 public SpliceJoint(List <Element> elements, Factory.JointCondition jc)
 {
     if (jc.Parts.Count != Parts.Length)
     {
         throw new Exception("SpliceJoint needs 2 elements.");
     }
     for (int i = 0; i < Parts.Length; ++i)
     {
         Parts[i] = new JointPart(elements, jc.Parts[i], this);
     }
 }
Exemplo n.º 4
0
        public EndJoint(List <Element> elements, JointCondition jc)
        {
            if (jc.Parts.Count < Parts.Length)
            {
                throw new Exception("EndJoint needs 1 elements.");
            }

            Parts[0] = new JointPart(elements, jc.Parts[0], this);

            CutPlane = DefaultCutPlane;
            Added    = DefaultAdded;
        }
Exemplo n.º 5
0
        private List <Vector3d> SortPartsClockwise()
        {
            var outerPt = OuterSurface.ClosestPoint(this.Plane.Origin);
            var innerPt = InnerSurface.ClosestPoint(this.Plane.Origin);

            ComponentIndex ci;
            double         s, t;

            //Vector3d normal;

            OuterSurface.ClosestPoint(outerPt, out outerPt, out ci, out s, out t, 0, out Normal);
            if (Normal * (outerPt - innerPt) < 0)
            {
                Normal.Reverse();
            }

            Normal = outerPt - innerPt;
            Normal.Unitize();

            var beams = new Beam[4];

            for (int i = 0; i < 4; ++i)
            {
                beams[i] = (Parts[i].Element as BeamElement).Beam;
            }

            var dirs = new Vector3d[4];

            for (int i = 0; i < 4; ++i)
            {
                dirs[i] = beams[i].Centreline.PointAt(beams[i].Centreline.Domain.Mid) - this.Plane.Origin;
            }

            List <int> indices;

            GluLamb.Utility.SortVectorsAroundPoint(dirs.ToList(), this.Plane.Origin, Normal, out indices);

            var parts   = new JointPart[4];
            var vectors = new Vector3d[4];

            for (int i = 0; i < indices.Count; ++i)
            {
                parts[i]   = Parts[indices[i]];
                vectors[i] = dirs[indices[i]];
            }

            Parts = parts;

            return(vectors.ToList());
        }
Exemplo n.º 6
0
        public FourWayJoint(List <Element> elements, Factory.JointCondition jc)
        {
            if (jc.Parts.Count != Parts.Length)
            {
                throw new Exception("FourWayJoint needs 4 elements.");
            }

            // Sort elements around the joint normal
            var vectors = new List <Vector3d>();
            var normal  = Vector3d.Zero;

            for (int i = 0; i < jc.Parts.Count; ++i)
            {
                var tan = GluLamb.Joints.JointUtil.GetEndConnectionVector((elements[jc.Parts[i].Index] as BeamElement).Beam, jc.Position);
                vectors.Add(tan);
            }
            for (int i = 0; i < vectors.Count; ++i)
            {
                int ii = (i + 1).Modulus(4);

                normal += Vector3d.CrossProduct(vectors[i], vectors[ii]);
            }

            normal /= vectors.Count;

            List <int> indices;

            Utility.SortVectorsAroundPoint(vectors, jc.Position, normal, out indices);

            for (int i = 0; i < Parts.Length; ++i)
            {
                Parts[i] = new JointPart(elements, jc.Parts[indices[i]], this);
            }

            var xaxis = Vector3d.CrossProduct(normal, Vector3d.ZAxis);

            if (xaxis.IsTiny(0.001))
            {
                xaxis = Vector3d.XAxis;
            }
            var yaxis = Vector3d.CrossProduct(xaxis, normal);

            this.Plane = new Plane(jc.Position, xaxis, yaxis);
        }
Exemplo n.º 7
0
 /// <summary>
 /// Creates a splice joint between two beam elements.
 /// </summary>
 /// <param name="eA">First beam element.</param>
 /// <param name="eB">Second beam element.</param>
 public SpliceJoint(Element eA, double parameterA, Element eB, double parameterB) : base()
 {
     Parts[0] = new JointPart(eA as BeamElement, this, 0, parameterA);
     Parts[1] = new JointPart(eB as BeamElement, this, 1, parameterB);
 }
Exemplo n.º 8
0
 /// <summary>
 /// Creates and mortise and tenon joint between two beam elements.
 /// </summary>
 /// <param name="tenon">Tenon</param>
 /// <param name="mortise">Mortise</param>
 public TenonJoint(List <Element> elements, Factory.JointConditionPart tenon, Factory.JointConditionPart mortise) : base()
 {
     Parts[0] = new JointPart(elements[tenon.Index] as BeamElement, this, tenon.Index, tenon.Parameter);
     Parts[1] = new JointPart(elements[mortise.Index] as BeamElement, this, mortise.Index, mortise.Parameter);
 }
Exemplo n.º 9
0
 /// <summary>
 /// Creates and mortise and tenon joint between two beam elements.
 /// </summary>
 /// <param name="tenon">Tenon</param>
 /// <param name="mortise">Mortise</param>
 public TenonJoint(Element tenon, double tenon_parameter, Element mortise, double mortise_parameter) : base()
 {
     Parts[0] = new JointPart(tenon as BeamElement, this, 0, tenon_parameter);
     Parts[1] = new JointPart(mortise as BeamElement, this, 1, mortise_parameter);
 }
Exemplo n.º 10
0
 /// <summary>
 /// Creates a crossing joint between two beam elements.
 /// </summary>
 /// <param name="beamA">Beam element that goes over.</param>
 /// <param name="beamB">Beam element that goes under.</param>
 public CrossJoint(Element beamA, double parameterA, Element beamB, double parameterB) : base()
 {
     Parts[0] = new JointPart(beamA as BeamElement, this, 0, parameterA);
     Parts[1] = new JointPart(beamB as BeamElement, this, 1, parameterB);
 }
Exemplo n.º 11
0
 /// <summary>
 /// Creates a joint between three beam elements.
 /// </summary>
 /// <param name="v0">First beam element in V.</param>
 /// <param name="v1">Second beam element in V.</param>
 /// <param name="floor">Floor plate beam element.</param>
 public VBeamJoint(Element v0, Element v1, Element floor) : base()
 {
     Parts[0] = new JointPart(v0 as BeamElement, this, 0);
     Parts[1] = new JointPart(v1 as BeamElement, this, 1);
     Parts[2] = new JointPart(floor as BeamElement, this, 2);
 }