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


C# XYZ.Divide方法代码示例

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


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

示例1: GetViewCoordinates

        /// <summary>
        /// returns XYZ and ZOOM/FOV value
        /// </summary>
        /// <param name="doc"></param>
        /// <param name="viewport"></param>
        /// <returns></returns>
        public Tuple<ViewOrientation3D, double, string, string> GetViewCoordinates(Document doc, VisualizationInfo viewport)
        {
            string type = ""; //change if i force ortho mode
              double zoom = 0; //fov or worldscale

              XYZ CameraDirection = new XYZ();
              XYZ CameraUpVector = new XYZ();
              XYZ CameraViewPoint = new XYZ();
              //retrive the force perspective value

              // IS ORTHOGONAL
              if (viewport.OrthogonalCamera != null)
              {
            if (viewport.OrthogonalCamera.CameraViewPoint == null || viewport.OrthogonalCamera.CameraUpVector == null || viewport.OrthogonalCamera.CameraDirection == null)
              return null;
            type = "OrthogonalCamera";
            zoom = UnitUtils.ConvertToInternalUnits(viewport.OrthogonalCamera.ViewToWorldScale, DisplayUnitType.DUT_METERS);
            CameraDirection = GetXYZ(viewport.OrthogonalCamera.CameraDirection.X, viewport.OrthogonalCamera.CameraDirection.Y, viewport.OrthogonalCamera.CameraDirection.Z);
            CameraUpVector = GetXYZ(viewport.OrthogonalCamera.CameraUpVector.X, viewport.OrthogonalCamera.CameraUpVector.Y, viewport.OrthogonalCamera.CameraUpVector.Z);
            CameraViewPoint = GetXYZ(viewport.OrthogonalCamera.CameraViewPoint.X, viewport.OrthogonalCamera.CameraViewPoint.Y, viewport.OrthogonalCamera.CameraViewPoint.Z);

              }

              else if (viewport.PerspectiveCamera != null)
              {
            if (viewport.PerspectiveCamera.CameraViewPoint == null || viewport.PerspectiveCamera.CameraUpVector == null || viewport.PerspectiveCamera.CameraDirection == null)
              return null;

            type = "PerspectiveCamera";
            zoom = viewport.PerspectiveCamera.FieldOfView;
            double z1 = 18 / Math.Tan(zoom / 2 * Math.PI / 180);//focale 1
            double z = 18 / Math.Tan(25 / 2 * Math.PI / 180);//focale, da controllare il 18, vedi PDF
            double factor = z1 - z;

            CameraDirection = GetXYZ(viewport.PerspectiveCamera.CameraDirection.X, viewport.PerspectiveCamera.CameraDirection.Y, viewport.PerspectiveCamera.CameraDirection.Z);
            CameraUpVector = GetXYZ(viewport.PerspectiveCamera.CameraUpVector.X, viewport.PerspectiveCamera.CameraUpVector.Y, viewport.PerspectiveCamera.CameraUpVector.Z);
            XYZ oldO = GetXYZ(viewport.PerspectiveCamera.CameraViewPoint.X, viewport.PerspectiveCamera.CameraViewPoint.Y, viewport.PerspectiveCamera.CameraViewPoint.Z);
            CameraViewPoint = (oldO.Subtract(CameraDirection.Divide(factor)));
              }
              else
            return null;
              // CHAGE VALUES ACCORDING TO BASEPOINT
              //THIS WAS the one with DOC
              ViewOrientation3D orient3d = ConvertBasePoint(CameraViewPoint, CameraDirection, CameraUpVector, true);

              return new Tuple<ViewOrientation3D, double, string, string>(orient3d, zoom, type, "New View");
        }
开发者ID:WeConnect,项目名称:issue-tracker,代码行数:53,代码来源:RevitWindow.xaml.cs

示例2: Evaluate

        public override Value Evaluate(FSharpList<Value> args)
        {
            if (!args[0].IsList)
                throw new Exception("A list of XYZs is required to average.");

            FSharpList<Value> lst = ((Value.List)args[0]).Item;

            XYZ average = new XYZ();
            foreach (Value v in lst)
            {
                XYZ pt = (XYZ)((Value.Container)v).Item;
                average = average.Add(pt);
            }

            average = average.Divide(lst.Count<Value>());
            pts.Add(average);

            return Value.NewContainer(average);
        }
开发者ID:epeter61,项目名称:Dynamo,代码行数:19,代码来源:dynGeometry.cs


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