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


C++ VerdictVector::y方法代码示例

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


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

示例1: localize_quad_for_ef

/*! 
  moves and rotates the quad such that it enables us to 
  use components of ef's
*/
void localize_quad_for_ef( VerdictVector node_pos[4])
{

  VerdictVector centroid(node_pos[0]);
  centroid += node_pos[1];
  centroid += node_pos[2];
  centroid += node_pos[3];
  
  centroid /= 4.0;

  node_pos[0] -= centroid;
  node_pos[1] -= centroid;
  node_pos[2] -= centroid;
  node_pos[3] -= centroid;

  VerdictVector rotate = node_pos[1] + node_pos[2] - node_pos[3] - node_pos[0];
  rotate.normalize();

  double cosine = rotate.x();
  double   sine = rotate.y();
 
  double xnew;
 
  for (int i=0; i < 4; i++) 
  {
    xnew =  cosine * node_pos[i].x() +   sine * node_pos[i].y();
    node_pos[i].y( -sine * node_pos[i].x() + cosine * node_pos[i].y() );
    node_pos[i].x(xnew);
  }
}
开发者ID:burlen,项目名称:visit_vtk_7_src,代码行数:34,代码来源:V_QuadMetric.C

示例2: v_tri_scaled_jacobian

/*!
  The scaled jacobian of a tri

  minimum of the jacobian divided by the lengths of 2 edge vectors
*/
C_FUNC_DEF double v_tri_scaled_jacobian( int /*num_nodes*/, double coordinates[][3])
{
  static const double detw = 2./sqrt(3.0);
  VerdictVector first, second;
  double jacobian; 
  
  VerdictVector edge[3];
  edge[0].set(coordinates[1][0] - coordinates[0][0],
              coordinates[1][1] - coordinates[0][1],
              coordinates[1][2] - coordinates[0][2]);

  edge[1].set(coordinates[2][0] - coordinates[0][0],
              coordinates[2][1] - coordinates[0][1],
              coordinates[2][2] - coordinates[0][2]);

  edge[2].set(coordinates[2][0] - coordinates[1][0],
              coordinates[2][1] - coordinates[1][1],
              coordinates[2][2] - coordinates[1][2]);
  first = edge[1]-edge[0];
  second = edge[2]-edge[0];

  VerdictVector cross = first * second;
  jacobian = cross.length();

  double max_edge_length_product;
  max_edge_length_product = VERDICT_MAX( edge[0].length()*edge[1].length(),
                            VERDICT_MAX( edge[1].length()*edge[2].length(), 
                                         edge[0].length()*edge[2].length() ) ); 

  if( max_edge_length_product < VERDICT_DBL_MIN )
    return (double)0.0;

  jacobian *= detw;
  jacobian /= max_edge_length_product; 

  if( compute_normal )
  {
    //center of tri
    double point[3], surf_normal[3];
    point[0] =  (coordinates[0][0] + coordinates[1][0] + coordinates[2][0]) / 3;
    point[1] =  (coordinates[0][1] + coordinates[1][1] + coordinates[2][1]) / 3;
    point[2] =  (coordinates[0][2] + coordinates[1][2] + coordinates[2][2]) / 3;

    //dot product
    compute_normal( point, surf_normal ); 
    if( (cross.x()*surf_normal[0] + 
         cross.y()*surf_normal[1] +
         cross.z()*surf_normal[2] ) < 0 )
      jacobian *= -1; 
  }

  if( jacobian > 0 )
    return (double) VERDICT_MIN( jacobian, VERDICT_DBL_MAX );
  return (double) VERDICT_MAX( jacobian, -VERDICT_DBL_MAX );

}
开发者ID:Paulxia,项目名称:SlicerVTK,代码行数:61,代码来源:V_TriMetric.cpp

示例3: product

inline void product( VerdictVector& a1,
                     VerdictVector& a2,
                     VerdictVector& a3,
                     VerdictVector& b1,
                     VerdictVector& b2,
                     VerdictVector& b3,
                     VerdictVector& c1,
                     VerdictVector& c2,
                     VerdictVector& c3 )
{

    VerdictVector x1, x2, x3;

    x1.set( a1.x(), a2.x(), a3.x() );
    x2.set( a1.y(), a2.y(), a3.y() );
    x3.set( a1.z(), a2.z(), a3.z() );

    c1.set( x1 % b1, x2 % b1, x3 % b1 );
    c2.set( x1 % b2, x2 % b2, x3 % b2 );
    c3.set( x1 % b3, x2 % b3, x3 % b3 );
}
开发者ID:RCBiczok,项目名称:VTK,代码行数:21,代码来源:verdict_defines.hpp

示例4: inverse

inline void inverse(VerdictVector x1,
                    VerdictVector x2,
                    VerdictVector x3,
                    VerdictVector& u1,
                    VerdictVector& u2,
                    VerdictVector& u3 )
{
    double  detx = v_determinant(x1, x2, x3);
    VerdictVector rx1, rx2, rx3;

    rx1.set(x1.x(), x2.x(), x3.x());
    rx2.set(x1.y(), x2.y(), x3.y());
    rx3.set(x1.z(), x2.z(), x3.z());

    u1 = rx2 * rx3;
    u2 = rx3 * rx1;
    u3 = rx1 * rx2;

    u1 /= detx;
    u2 /= detx;
    u3 /= detx;
}
开发者ID:RCBiczok,项目名称:VTK,代码行数:22,代码来源:verdict_defines.hpp


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