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


C++ ON_Plane::CreateFromNormal方法代码示例

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


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

示例1: Create

bool ON_Arc::Create( // arc is parallel to XY plane
  const ON_3dPoint& center, // center
  double r,            // radius
  double angle_radians // angle in radians
  )
{
  ON_Plane p;
  p.CreateFromNormal( center, ON_zaxis );
  return Create( ON_Circle(p,r), ON_Interval( 0.0, angle_radians ) );
}
开发者ID:Bastl34,项目名称:PCL,代码行数:10,代码来源:opennurbs_arc.cpp

示例2: Morph

bool ON_Plane::Morph( const ON_SpaceMorph& morph )
{
  ON_Plane mp;
  double s = sqrt( fabs(origin.MaximumCoordinate())*ON_SQRT_EPSILON + ON_ZERO_TOLERANCE );
  mp.xaxis = morph.MorphVector(origin,s*xaxis);
  mp.yaxis = morph.MorphVector(origin,s*yaxis);
  mp.zaxis = morph.MorphVector(origin,s*zaxis);
  origin = morph.MorphPoint(origin);
  UpdateEquation();
  bool bx = mp.xaxis.Unitize();
  bool by = mp.yaxis.Unitize();
  bool bz = mp.zaxis.Unitize();
  if (!bx)
  {
    mp.xaxis = ON_CrossProduct(mp.yaxis,mp.zaxis);
    bx = mp.xaxis.Unitize();
  }
  if (!by)
  {
    mp.yaxis = ON_CrossProduct(mp.zaxis,mp.xaxis);
    by = mp.yaxis.Unitize();
  }
  if (!bz)
  {
    mp.zaxis = ON_CrossProduct(mp.xaxis,mp.yaxis);
    bz = mp.zaxis.Unitize();
  }

  mp.origin.Set(0.0,0.0,0.0);
  mp.UpdateEquation();
  bool rc = mp.IsValid();
  ON_3dVector x, y, z;
  if ( rc )
  {
    x = mp.xaxis;
    y = mp.yaxis;
    z = mp.zaxis;
  }
  else
  {
    x = ON_CrossProduct(mp.yaxis,mp.zaxis);
    y = ON_CrossProduct(mp.zaxis,mp.xaxis);
    z = ON_CrossProduct(mp.xaxis,mp.yaxis);
    x.Unitize();
    y.Unitize();
    z.Unitize();
    x = mp.xaxis + x;
    y = mp.yaxis + y;
    z = mp.zaxis + z;
    x.Unitize();
    y.Unitize();
    z.Unitize();
    rc = mp.CreateFromFrame(ON_origin,x,y);
    if (rc)
    {
      x = mp.xaxis;
      y = mp.yaxis;
      z = mp.zaxis;
    }
    else
    {
      rc = mp.CreateFromFrame(ON_origin,y,z);
      if ( rc )
      {
        y = mp.xaxis;
        z = mp.yaxis;
        x = mp.zaxis;
      }
      else
      {
        rc = mp.CreateFromFrame(ON_origin,z,x);
        if (rc)
        {
          z = mp.xaxis;
          x = mp.yaxis;
          y = mp.zaxis;
        }
        else
        {
          rc = mp.CreateFromNormal(ON_origin,z);
          if (rc)
          {
            x = mp.xaxis;
            y = mp.yaxis;
            z = mp.zaxis;
          }
        }
      }
    }
  }

  if (rc)
  {
    xaxis = x;
    yaxis = y;
    zaxis = z;
    UpdateEquation();
  }

  return rc;
//.........这里部分代码省略.........
开发者ID:jl2,项目名称:ONView,代码行数:101,代码来源:opennurbs_plane.cpp


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