コード例 #1
0
        public override Mesh MapToCurveSpace(Mesh m)
        {
            Plane cp, cpp = Plane.Unset;

            if (!Centreline.TryGetPlane(out cp, Rhino.RhinoDoc.ActiveDoc.ModelAbsoluteTolerance))
            {
                throw new Exception("SingleCurvedGlulam: Centreline is not planar!");
            }
            double t, l;

            Mesh mesh = new Mesh();

            for (int i = 0; i < m.Vertices.Count; ++i)
            {
                Point3d p = new Point3d(m.Vertices[i]);
                Centreline.ClosestPoint(p, out t);
                l = Centreline.GetLength(new Interval(Centreline.Domain.Min, t));
                //Vector3d xaxis = Vector3d.CrossProduct(cp.ZAxis, Centreline.TangentAt(t));
                //cpp = new Plane(Centreline.PointAt(t), xaxis, cp.ZAxis);

                cpp = GetPlane(t);
                p.Transform(Rhino.Geometry.Transform.PlaneToPlane(cpp, Plane.WorldXY));
                p.Z = l;

                mesh.Vertices.Add(p);
            }

            mesh.Faces.AddFaces(m.Faces);
            mesh.FaceNormals.ComputeFaceNormals();

            return(mesh);
        }
コード例 #2
0
ファイル: SingleCurvedGlulam.cs プロジェクト: tsvilans/tas
        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);
        }