示例#1
0
BOOL CMainDlg::OnInitDialog()
{
	CDialogEx::OnInitDialog();

	SetIcon(m_hIcon, TRUE);			// Set big icon
	SetIcon(m_hIcon, FALSE);		// Set small icon

	m_solutionChangeConnection = m_solver.DoOnSolutionChange([=] {
		UpdateEquation();
	});

	UpdateEquation();

	return TRUE;  // return TRUE  unless you set the focus to a control
}
示例#2
0
bool ON_Plane::CreateFromFrame(
    const ON_3dPoint&  P, // point on the plane
    const ON_3dVector& X, // non-zero vector in plane
    const ON_3dVector& Y  // another non-zero vector in the plane
    )
{
  origin = P;

  xaxis = X;
  xaxis.Unitize();
  yaxis = Y - ON_DotProduct( Y, xaxis)*xaxis;
  yaxis.Unitize();
  zaxis = ON_CrossProduct( xaxis, yaxis );
  bool b = zaxis.Unitize();
  UpdateEquation();
  if ( b )
  {
    // 11 February 2004 Dale Lear
    //     Add more validation checks.
    b = IsValid();
    if ( b )
    {
      // make sure zaxis is perp to Y
      if ( fabs(Y*zaxis) > ON_SQRT_EPSILON*Y.Length() )
        b = false;
    }
  }
  return b;
}
示例#3
0
bool ON_Plane::Flip()
{
  ON_3dVector v = xaxis;
  xaxis = yaxis;
  yaxis = v;
  zaxis = -zaxis;
  UpdateEquation();
  return true;
}
示例#4
0
文件: NaGePlane.cpp 项目: cybaj/NAK
NaGePlane::NaGePlane(const NaGePoint3D& P1, const NaGeVector3D& V1, const NaGeVector3D& V2)
{
	NaGeVector3D v1 = V1, v2 = V2;
	NaGeVector3D Dir = v1^v2;

	NaGeAxisSystem ax(P1, Dir, v1);
	itsLocation = ax;

	UpdateEquation();
	
	geomType = GEPLANE;
}
示例#5
0
文件: NaGePlane.cpp 项目: cybaj/NAK
NaGePlane::NaGePlane(const NaGePoint3D& P1, const NaGePoint3D& P2, const NaGePoint3D& P3)
{
	NaGeVector3D V1(P1, P2);
	NaGeVector3D V2(P1, P3);
	NaGeVector3D Dir = V1^V2;

	NaGeAxisSystem ax(P1, Dir, V1);
	itsLocation = ax;

	UpdateEquation();
	
	geomType = GEPLANE;
}
示例#6
0
文件: NaGePlane.cpp 项目: cybaj/NAK
NaGePlane::NaGePlane(const NaGeOneAxis& Ax)
{
	NaGeOneAxis ax = Ax;

	NaGePoint3D P = Ax.GetPosition();
	NaGeVector3D V = Ax.GetDirection();

	NaGeAxisSystem location(P, V);

	itsLocation = location;

	UpdateEquation();
	geomType = GEPLANE;
}
示例#7
0
bool ON_Plane::CreateFromNormal(
    const ON_3dPoint&  P, // point on the plane
    const ON_3dVector& N  // non-zero normal to the plane
    )
{
  origin = P;
  zaxis = N;
  bool b = zaxis.Unitize();
  xaxis.PerpendicularTo( zaxis );
  xaxis.Unitize();
  yaxis = ON_CrossProduct( zaxis, xaxis );
  yaxis.Unitize();

  UpdateEquation();

  return b;
}
示例#8
0
// rotate plane about a point and axis
bool ON_Plane::Rotate(
      double sin_angle,          // sin(angle)
      double cos_angle,          // cos(angle)
      const ON_3dVector& axis, // axis of rotation
      const ON_3dPoint& center // center of rotation
      )
{
  bool rc = false;
  ON_Xform rot;
  if ( center == origin ) {
    rot.Rotation( sin_angle, cos_angle, axis, ON_origin );
    xaxis = rot*xaxis;
    yaxis = rot*yaxis;
    zaxis = rot*zaxis;
    rc = UpdateEquation();
  }
  else {
    rot.Rotation( sin_angle, cos_angle, axis, center );
    rc = Transform( rot );
  }
  return rc;
}
示例#9
0
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;
}
示例#10
0
void ON_Plane::SetOrigin( const ON_3dPoint& origin_point)
{
  origin = origin_point;
  UpdateEquation();
}