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


C# Scientrace.lineThroughPlane方法代码示例

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


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

示例1: overlapsWithPlane

        /// <summary>
        /// Returns true if two Plane-instances cover the same area
        /// </summary>
        /// <returns><c>true</c> if planes overlap, <c>false</c> otherwise.</returns>
        /// <param name="anotherPlane">the other plane.</param>
        public bool overlapsWithPlane(Scientrace.PlaneBorder anotherPlane)
        {
            if ((this.allowedDirNormal.normalized().toVector() - anotherPlane.allowedDirNormal.normalized().toVector()).length > MainClass.SIGNIFICANTLY_SMALL)
            return false; //Normals differ significantly. Nuff said.

            // Normals are considered equal. Are the planes locations in space?
            Scientrace.Location loc1 = (this.lineThroughPlane(new Line(Location.ZeroLoc(), this.getNormal())));
            Scientrace.Location loc2 = (anotherPlane.lineThroughPlane(new Line(Location.ZeroLoc(), this.getNormal())));
            // if these locations are considered the same, the planes overlap.
            return ((loc1 - loc2).length < MainClass.SIGNIFICANTLY_SMALL);
        }
开发者ID:JoepBC,项目名称:scientrace,代码行数:16,代码来源:PlaneBorder.cs

示例2: getIntersectionLineWith

        /// <summary>
        /// Creates a line starting at the projection of this.loc on the intersection between this and another Plane. 
        /// The direction of the line is that of the crossproduct of this.normal and anotherPlane.normal.
        /// </summary>
        /// <returns>A line along the intersection of this and anotherPlane, returns "null" if two planes are significantly parallel</returns>
        /// <param name="anotherPlane">A plane to calculate the intersection with</param>
        public Scientrace.Line getIntersectionLineWith(Scientrace.Plane anotherPlane)
        {
            Scientrace.UnitVector n1, n2;
            n1 = this.getNorm();
            n2 = anotherPlane.getNorm();
            Vector tw = n1.crossProduct(n2);
            if (tw.length < MainClass.SIGNIFICANTLY_SMALL) {
            //Console.WriteLine("WARNING: two planes do not intersect since they are parallel.");
            return null;
            }
            UnitVector intersection_direction = tw.tryToUnitVector();

            Vector tl1 = n1.crossProduct(intersection_direction);
            if (tl1.length == 0)
            throw new Exception("Plane.getIntersectionLineWith/l1.length can never be zero. If this happens, notify the [email protected] about this..."+this.ToString()+anotherPlane.ToString());
            // l1 lies in "this" plane, and is orthogonal to the intersectionline-direction
            UnitVector l1 = tl1.tryToUnitVector();

            // where l1, starting at this.loc, meets anotherPlane we found a location on the intersectionline.
            Scientrace.Location retLoc = anotherPlane.lineThroughPlane(new Line(this.loc, l1));
            if (retLoc == null) {
            Console.WriteLine("WARNING: retLoc == null; l1: "+l1.ToString()+" ; anotherPlane:"+anotherPlane.getNorm().ToString());
            return null;
            }
            return new Line(retLoc, intersection_direction);
        }
开发者ID:JoepBC,项目名称:scientrace,代码行数:32,代码来源:Plane.cs


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