Beispiel #1
0
        /// <summary>
        /// Create FdCoordinateSystem from Rhino plane.
        /// </summary>
        internal static FdCoordinateSystem FromRhinoPlane(this Rhino.Geometry.Plane obj)
        {
            FdPoint3d  origin = obj.Origin.FromRhino();
            FdVector3d localX = obj.XAxis.FromRhino();
            FdVector3d localY = obj.YAxis.FromRhino();
            FdVector3d localZ = obj.ZAxis.FromRhino();

            return(new FdCoordinateSystem(origin, localX, localY, localZ));
        }
Beispiel #2
0
        public void GetLengthLine()
        {
            // line
            var p0   = new FdPoint3d(0, 0, 0);
            var p1   = new FdPoint3d(1, 0, 0);
            var y    = new FdVector3d(0, 1, 0);
            var line = new Edge(p0, p1, y);

            Assert.IsTrue(Math.Abs(line.Length - 1) <= Tolerance.LengthComparison);
        }
Beispiel #3
0
        public void GetLengthInvalid()
        {
            // some other type
            var p0   = new FdPoint3d(0, 0, 0);
            var p1   = new FdPoint3d(1, 0, 0);
            var y    = new FdVector3d(0, 1, 0);
            var line = new Edge(p0, p1, y);
            var edge = line;

            edge._type = "someType";
            Assert.ThrowsException <ArgumentException>(() => edge.Length, "Should throw exception on not supported edge type");
        }
Beispiel #4
0
        public void GetLengthArc()
        {
            // arc by
            var center     = new FdPoint3d(0, 0, 0);
            var radius     = 1;
            var startAngle = 0;
            var endAngle   = Math.PI;
            var xAxis      = new FdVector3d(1, 0, 0);
            var cs         = FdCoordinateSystem.Global();
            var arc1       = new Edge(radius, startAngle, endAngle, center, xAxis, cs);

            Assert.IsTrue(Math.Abs(arc1.Length - Math.PI) <= Tolerance.LengthComparison);
        }
Beispiel #5
0
        /// <summary>
        /// Create Edge (Arc1) from Rhino open ArcCurve.
        /// </summary>
        public static Geometry.Edge FromRhinoArc1(this Rhino.Geometry.ArcCurve obj)
        {
            double     radius      = obj.Arc.Radius;
            double     startAngle  = 0;
            double     endAngle    = obj.Arc.EndAngle - obj.Arc.StartAngle;
            FdPoint3d  centerPoint = obj.Arc.Center.FromRhino();
            FdVector3d xAxis       = new FdVector3d(centerPoint, obj.Arc.StartPoint.FromRhino());

            // lcs
            FdCoordinateSystem cs = obj.FromRhinoCurve();

            // return
            return(new Geometry.Edge(radius, startAngle, endAngle, centerPoint, xAxis, cs));
        }
 private void Initialize(FdPoint3d firstPoint, FdPoint3d secondPoint, RigidityDataType2 rigidity, GuidListType[] references, string identifier)
 {
     this.EntityCreated();
     this.Points = new FdPoint3d[2]
     {
         firstPoint,
         secondPoint
     };
     this.LocalX     = FdVector3d.UnitX();
     this.LocalY     = FdVector3d.UnitY();
     this.Rigidity   = rigidity;
     this.References = references;
     this.Identifier = identifier;
 }