当前位置: 首页>>代码示例>>C#>>正文


C# Line.get_EndPoint方法代码示例

本文整理汇总了C#中Line.get_EndPoint方法的典型用法代码示例。如果您正苦于以下问题:C# Line.get_EndPoint方法的具体用法?C# Line.get_EndPoint怎么用?C# Line.get_EndPoint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Line的用法示例。


在下文中一共展示了Line.get_EndPoint方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Validata

        /// <summary>
        /// make sure the line we get from the its geometry is upright to the location line 
        /// </summary>
        /// <param name="line1">the first line</param>
        /// <param name="line2">the second line</param>
        /// <returns>if the two line is upright, true will be retured</returns>
        bool Validata(Line line1, Line line2)
        {
            //if it is not a linear line
            if (null == line1 || null == line2)
            {
                return false;
            }

            //get the first line's length
            Autodesk.Revit.DB.XYZ newLine = new Autodesk.Revit.DB.XYZ (line1.get_EndPoint(1).X - line1.get_EndPoint(0).X,
                                 line1.get_EndPoint(1).Y - line1.get_EndPoint(0).Y,
                                 line1.get_EndPoint(1).Z - line1.get_EndPoint(0).Z);
            double x1 = newLine.X * newLine.X;
            double y1 = newLine.Y * newLine.Y;
            double z1 = newLine.Z * newLine.Z;
            double sqrt1 = Math.Sqrt(x1 + y1 + z1);

            //get the second line's length
            Autodesk.Revit.DB.XYZ vTemp = new Autodesk.Revit.DB.XYZ (line2.get_EndPoint(1).X - line2.get_EndPoint(0).X,
                                line2.get_EndPoint(1).Y - line2.get_EndPoint(0).Y,
                                line2.get_EndPoint(1).Z - line2.get_EndPoint(0).Z);
            double x2 = vTemp.X * vTemp.X;
            double y2 = vTemp.Y * vTemp.Y;
            double z2 = vTemp.Z * vTemp.Z;
            double sqrt2 = Math.Sqrt(x1 + y1 + z1);

            double VP = newLine.X * vTemp.X + newLine.Y * vTemp.Y + newLine.Z * vTemp.Z;
            double compare = VP / (sqrt1 * sqrt2);
            if ((-precision <= compare) && (precision >= compare))
            {
                return true;
            }
            return false;
        }
开发者ID:AMEE,项目名称:revit,代码行数:40,代码来源:Command.cs

示例2: IsVertical

        /// <summary>
        /// judge whether two lines are vertical
        /// </summary>
        /// <param name="line1"></param>
        /// <param name="line2"></param>
        /// <returns></returns>
        private static bool IsVertical(Line line1, Line line2)
        {
            Autodesk.Revit.DB.XYZ vector1 = SubXYZ(line1.get_EndPoint(0), line1.get_EndPoint(1));
            Autodesk.Revit.DB.XYZ vector2 = SubXYZ(line2.get_EndPoint(0), line2.get_EndPoint(1));

            double result = DotMatrix(vector1, vector2);

            if (Math.Abs(result) < PRECISION)
            {
                return true;
            }
            return false;
        }
开发者ID:AMEE,项目名称:revit,代码行数:19,代码来源:GeomUtil.cs

示例3: GetLine2D

 /// <summary>
 /// generate a Line2D instance using a Line's data
 /// </summary>
 /// <param name="line">where new Line2D get data</param>
 /// <returns>new Line2D</returns>
 private static Line2D GetLine2D(Line line)
 {
     Line2D result   = new Line2D();
     result.StartPnt = new PointF((float)line.get_EndPoint(0).X, (float)line.get_EndPoint(0).Y);
     result.EndPnt   = new PointF((float)line.get_EndPoint(1).X, (float)line.get_EndPoint(1).Y);
     return result;
 }
开发者ID:AMEE,项目名称:revit,代码行数:12,代码来源:BeamSystemSketch.cs

示例4: IsParallel

        /// <summary>
        /// judge whether a face and a line are parallel
        /// </summary>
        /// <param name="face"></param>
        /// <param name="line"></param>
        /// <returns></returns>
        public static bool IsParallel(Face face, Line line)
        {
            List<Autodesk.Revit.DB.XYZ > points = GetPoints(face);
            Autodesk.Revit.DB.XYZ vector1 = SubXYZ(points[0], points[1]);
            Autodesk.Revit.DB.XYZ vector2 = SubXYZ(points[1], points[2]);
            Autodesk.Revit.DB.XYZ refer = SubXYZ(line.get_EndPoint(0), line.get_EndPoint(1));

            Autodesk.Revit.DB.XYZ cross = CrossMatrix(vector1, vector2);
            double result = DotMatrix(cross, refer);

            if (result < PRECISION)
            {
                return true;
            }
            return false;
        }
开发者ID:AMEE,项目名称:revit,代码行数:22,代码来源:GeomUtil.cs

示例5: GetLength

 /// <summary>
 /// get the length of the given line
 /// </summary>
 /// <param name="line"></param>
 /// <returns>length</returns>
 public static double GetLength(Line line)
 {
     Autodesk.Revit.DB.XYZ  sub = SubXYZ(line.get_EndPoint(0), line.get_EndPoint(1));
     double length = Math.Sqrt(sub.X * sub.X + sub.Y * sub.Y + sub.Z * sub.Z);
     return length;
 }
开发者ID:AMEE,项目名称:revit,代码行数:11,代码来源:GeomUtil.cs

示例6: GetXYParallelLine

        /// <summary>
        /// get parallel line with give distance with given line in XY plane
        /// </summary>
        /// <param name="inLine">given line</param>
        /// <param name="distance">distance from given line</param>
        /// <returns>paralleled line</returns>
        public static Line GetXYParallelLine(Line inLine, double distance)
        {
            Autodesk.Revit.DB.XYZ  direct = SubXYZ(inLine.get_EndPoint(1), inLine.get_EndPoint(0));
            double length = Math.Sqrt((-direct.Y) * (-direct.Y) + direct.X * direct.X);
            double temp = distance / length;

            Autodesk.Revit.DB.XYZ dPerp = new XYZ(-direct.Y * temp,
                direct.X * temp, 0.0);

            Autodesk.Revit.DB.XYZ  startPoint = AddXYZ(inLine.get_EndPoint(0), dPerp);
            Autodesk.Revit.DB.XYZ  endPoint = AddXYZ(inLine.get_EndPoint(1), dPerp);
            Line outLine = Line.get_Bound(startPoint, endPoint);
            //Line outLine = new Line(ref startPoint, ref endPoint);

            return outLine;
        }
开发者ID:AMEE,项目名称:revit,代码行数:22,代码来源:GeomUtil.cs

示例7: GetScaledLine

        /// <summary>
        /// Get scaled line which has both the same center and direction with give line
        /// </summary>
        /// <param name="inLine">given line</param>
        /// <param name="scale">scale value</param>
        /// <returns>scaled line</returns>
        public static Line GetScaledLine(Line inLine, double scale)
        {
            Autodesk.Revit.DB.XYZ  startPoint = inLine.get_EndPoint(0);
            Autodesk.Revit.DB.XYZ  endPoint = inLine.get_EndPoint(1);

            Autodesk.Revit.DB.XYZ  temp1 = SubXYZ(endPoint, startPoint);
            Autodesk.Revit.DB.XYZ  temp2 = MultiXYZ(temp1, (scale - 1) / 2);
            Autodesk.Revit.DB.XYZ  startPoint2 = SubXYZ(startPoint, temp2);
            Autodesk.Revit.DB.XYZ  endPoint2 = AddXYZ(endPoint, temp2);

            Line outLine = Line.get_Bound(startPoint2, endPoint2);
            //Line outLine = new Line(ref startPoint2, ref endPoint2);
            return outLine;
        }
开发者ID:AMEE,项目名称:revit,代码行数:20,代码来源:GeomUtil.cs

示例8: TransformLine

        /// <summary>
        /// Get the line to create grid according to the specified bubble location
        /// </summary>
        /// <param name="line">The original selected line</param>
        /// <param name="bubLoc">bubble location</param>
        /// <returns>The line to create grid</returns>
        protected Line TransformLine(Line line, BubbleLocation bubLoc)
        {
            Line lineToCreate;

            // Create grid according to the bubble location
            if (bubLoc == BubbleLocation.StartPoint)
            {
                lineToCreate = line;
            }
            else
            {
                Autodesk.Revit.DB.XYZ startPoint = line.get_EndPoint(1);
                Autodesk.Revit.DB.XYZ endPoint = line.get_EndPoint(0);
                lineToCreate = NewLine(startPoint, endPoint);
            }

            return lineToCreate;
        }
开发者ID:AMEE,项目名称:revit,代码行数:24,代码来源:CreateGridsData.cs


注:本文中的Line.get_EndPoint方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。