美文网首页狮猿社_Rhino
Determine Normal Direction of Br

Determine Normal Direction of Br

作者: 锦囊喵 | 来源:发表于2020-08-06 11:00 被阅读0次

Demonstrates how to determine the normal direction of a Brep face at a specified point.

partial class Examples
{
  public static Result DetermineNormalDirectionOfBrepFace(RhinoDoc doc)
  {
    // select a surface
    var gs = new GetObject();
    gs.SetCommandPrompt("select surface");
    gs.GeometryFilter = ObjectType.Surface;
    gs.DisablePreSelect();
    gs.SubObjectSelect = false;
    gs.Get();
    if (gs.CommandResult() != Result.Success)
      return gs.CommandResult();
    // get the selected face
    var face = gs.Object(0).Face();
    if (face == null)
      return Result.Failure;

    // pick a point on the surface.  Constain
    // picking to the face.
    var gp = new GetPoint();
    gp.SetCommandPrompt("select point on surface");
    gp.Constrain(face, false);
    gp.Get();
    if (gp.CommandResult() != Result.Success)
      return gp.CommandResult();

    // get the parameters of the point on the
    // surface that is clesest to gp.Point()
    double u, v;
    if (face.ClosestPoint(gp.Point(), out u, out v))
    {
      var direction = face.NormalAt(u, v);
      if (face.OrientationIsReversed)
        direction.Reverse();
      RhinoApp.WriteLine(
        string.Format(
          "Surface normal at uv({0:f},{1:f}) = ({2:f},{3:f},{4:f})",
          u, v, direction.X, direction.Y, direction.Z));
    }
    return Result.Success;
  }
}

相关文章

  • Determine Normal Direction of Br

    Demonstrates how to determine the normal direction of a B...

  • 在 cfx-solver 的 monitor 中'normal

    在 cfx-solver 中,'monitor->forces->normal forcex-direction ...

  • Funky Trunks

    Life’s too short to be normal ! SO, DO YOU EVEN SWIM BR...

  • 文本换行操作

    white-space: normal;word-wrap: break-word;/中文自动折行/word-br...

  • animation-direction

    animation-direction等于normal。动画循环播放时,每次都是从结束状态跳回到起始状态,再开始播...

  • direction

    好像确实还没有想过输出什么样的策划类文章。 不算资历不够吧,只是觉得还没功力到能总结一套普适的方法论。不过其实当年...

  • The direction

    10-29 Long time no see.How are you?I am sorry to bother y...

  • direction

    11.40素描课 每节的素描课都是一种体验 袁老师都会讲很多天马行空很有意思的事情和我们分享 可是每一次我都不能...

  • Direction

    礼品盒子打开,放在展示的桌子上,与勿忘我的干花一起静静地躺在格子图案的桌布上。 我等待着,时间可以开启对美好生活的...

  • Direction

    Turn left. Take a left. Make a left when you come to the ...

网友评论

    本文标题:Determine Normal Direction of Br

    本文链接:https://www.haomeiwen.com/subject/lprzrktx.html