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


C# Line.Project方法代码示例

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


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

示例1: DelayedHitCalc

 public override RealHitInfo DelayedHitCalc(Line by, HitInfo hit)
 {
     RealHitInfo realHit = new RealHitInfo();
     realHit.HitStuff = Surface;
     realHit.Pigment = Pigment;
     realHit.Normal = new Line();
     realHit.Normal.Start = by.Project(hit.HitDist);
     realHit.Normal.Direct.Dx = 0;
     realHit.Normal.Direct.Dy = 0;
     realHit.Normal.Direct.Dz = 0;
     switch (hit.SurfaceIndex)
     {
         case 0:
             Point hitLoc2 = inv.Apply(realHit.Normal.Start);
             realHit.Normal.Direct.Dx = hitLoc2.X;
             realHit.Normal.Direct.Dy = hitLoc2.Y;
             realHit.Normal.Direct.Dz = hitLoc2.Z;
             break;
         default:
             throw new InvalidOperationException("Invalid surface index in hitdata");
     }
     Vector before = realHit.Normal.Direct;
     realHit.Normal.Direct = trans.Apply(realHit.Normal.Direct);
     if (realHit.Normal.Direct.Dot(by.Direct) > 0)
     {
         realHit.Normal.Direct.ScaleSelf(-1.0);
     }
     return realHit;
 }
开发者ID:Tilps,项目名称:Stash,代码行数:29,代码来源:Sphere.cs

示例2: DelayedHitCalc

 public override RealHitInfo DelayedHitCalc(Line by, HitInfo hit)
 {
     RealHitInfo realHit = new RealHitInfo();
     realHit.Normal = new Line();
     realHit.HitStuff = Surface;
     realHit.Pigment = Pigment;
     realHit.Normal.Start = by.Project(hit.HitDist);
     realHit.Normal.Direct.Dx = 0;
     realHit.Normal.Direct.Dy = 0;
     realHit.Normal.Direct.Dz = 0;
     Point hitLoc;
     Vector deviance = new Vector();
     if (rounded)
     {
         hitLoc = inv.Apply(realHit.Normal.Start);
         if (hit.SurfaceIndex != 5 || !RoundedTopOnly)
         {
             if (hitLoc.X < -1 + XRounding)
             {
                 switch (hit.SurfaceIndex)
                 {
                     case 2:
                     case 3:
                     case 4:
                     case 5:
                         deviance.Dx = -1 + (hitLoc.X + 1) / XRounding;
                         break;
                 }
             }
             if (hitLoc.X > 1 - XRounding)
             {
                 switch (hit.SurfaceIndex)
                 {
                     case 2:
                     case 3:
                     case 4:
                     case 5:
                         deviance.Dx = 1 - (1 - hitLoc.X) / XRounding;
                         break;
                 }
             }
             if (hitLoc.Y < -1 + YRounding)
             {
                 switch (hit.SurfaceIndex)
                 {
                     case 0:
                     case 1:
                     case 4:
                     case 5:
                         deviance.Dy = -1 + (hitLoc.Y + 1) / YRounding;
                         break;
                 }
             }
             if (hitLoc.Y > 1 - YRounding)
             {
                 switch (hit.SurfaceIndex)
                 {
                     case 0:
                     case 1:
                     case 4:
                     case 5:
                         deviance.Dy = 1 - (1 - hitLoc.Y) / YRounding;
                         break;
                 }
             }
         }
         if (!RoundedTopOnly && hitLoc.Z < -1 + ZRounding)
         {
             switch (hit.SurfaceIndex)
             {
                 case 0:
                 case 1:
                 case 2:
                 case 3:
                     deviance.Dz = -1 +(hitLoc.Z + 1) / ZRounding;
                     break;
             }
         }
         if (hitLoc.Z > 1 - ZRounding)
         {
             switch (hit.SurfaceIndex)
             {
                 case 0:
                 case 1:
                 case 2:
                 case 3:
                     deviance.Dz = 1 - (1 - hitLoc.Z) / ZRounding;
                     break;
             }
         }
     }
     switch (hit.SurfaceIndex)
     {
         case 0:
             realHit.Normal.Direct.Dx = 1;
             break;
         case 1:
             realHit.Normal.Direct.Dx = -1;
             break;
         case 2:
//.........这里部分代码省略.........
开发者ID:Tilps,项目名称:Stash,代码行数:101,代码来源:Box.cs

示例3: DelayedHitCalc

 public override RealHitInfo DelayedHitCalc(Line by, HitInfo hit)
 {
     RealHitInfo realHit = new RealHitInfo();
     realHit.HitStuff = Surface;
     realHit.Pigment = Pigment;
     realHit.Normal = new Line();
     realHit.Normal.Start = by.Project(hit.HitDist);
     realHit.Normal.Direct.Dx = 0;
     realHit.Normal.Direct.Dy = 0;
     realHit.Normal.Direct.Dz = 0;
     Point hitLoc;
     Vector deviance = new Vector();
     if (rounded)
     {
         hitLoc = inv.Apply(realHit.Normal.Start);
         if (hit.SurfaceIndex == 1 || (!RoundedTopOnly && hit.SurfaceIndex == 2))
         {
             double r = Math.Sqrt(hitLoc.X * hitLoc.X + hitLoc.Y * hitLoc.Y);
             if (r > 1 - RRounding)
             {
                 double dr = (1 - (1 - r) / RRounding) / (r);
                 deviance.Dx = hitLoc.X * dr;
                 deviance.Dy = hitLoc.Y * dr;
             }
         }
         if (!RoundedTopOnly && hitLoc.Z < -1 + ZRounding)
         {
             switch (hit.SurfaceIndex)
             {
                 case 0:
                     deviance.Dz = -1 + (hitLoc.Z + 1) / ZRounding;
                     break;
             }
         }
         if (hitLoc.Z > 1 - ZRounding)
         {
             switch (hit.SurfaceIndex)
             {
                 case 0:
                     deviance.Dz = 1 - (1 - hitLoc.Z) / ZRounding;
                     break;
             }
         }
     }
     switch (hit.SurfaceIndex)
     {
         case 0:
             Point hitLoc2 = inv.Apply(realHit.Normal.Start);
             realHit.Normal.Direct.Dx = hitLoc2.X;
             realHit.Normal.Direct.Dy = hitLoc2.Y;
             break;
         case 1:
             realHit.Normal.Direct.Dz = 1;
             break;
         case 2:
             realHit.Normal.Direct.Dz = -1;
             break;
         default:
             throw new InvalidOperationException("Invalid surface index in hitdata");
     }
     Vector before = realHit.Normal.Direct;
     realHit.Normal.Direct = trans.Apply(realHit.Normal.Direct);
     if (realHit.Normal.Direct.Dot(by.Direct) > 0)
     {
         if (rounded)
         {
             before.ScaleSelf(-1.0);
             deviance.ScaleSelf(-1.0);
         }
         else
             realHit.Normal.Direct.ScaleSelf(-1.0);
     }
     if (rounded)
     {
         realHit.Normal.Direct = before;
         realHit.Normal.Direct.Add(deviance);
         realHit.Normal.Direct = trans.Apply(realHit.Normal.Direct);
         if (realHit.Normal.Direct.Dot(by.Direct) > 0)
         {
             Vector perp1 = realHit.Normal.Direct.Cross(by.Direct);
             realHit.Normal.Direct = by.Direct.Cross(perp1);
         }
        }
     return realHit;
 }
开发者ID:Tilps,项目名称:Stash,代码行数:85,代码来源:Cylinder.cs

示例4: AreLinesEqual

      private bool AreLinesEqual(Line line1, Line line2)
      {
         if (!line1.IsBound || !line2.IsBound)
         {
            // Two unbound lines are equal if they are going in the same direction and the origin
            // of one lies on the other one.
            return line1.Direction.IsAlmostEqualTo(line2.Direction) &&
               MathUtil.IsAlmostZero(line1.Project(line2.Origin).Distance);
         }

         for (int ii = 0; ii < 2; ii++)
         {
            if (line1.GetEndPoint(0).IsAlmostEqualTo(line2.GetEndPoint(ii)) &&
                line1.GetEndPoint(1).IsAlmostEqualTo(line2.GetEndPoint(1 - ii)))
               return true;
         }

         return false;
      }
开发者ID:whztt07,项目名称:RevitCustomIFCexporter,代码行数:19,代码来源:IFCGridAxis.cs


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