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


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

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


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

示例1: inBox

bool inBox(const Vec3r& inter, const Vec3r& box_min, const Vec3r& box_max){
    if(((inter.x()>=box_min.x()) && (inter.x() <box_max.x()))
        && ((inter.y()>=box_min.y()) && (inter.y() <box_max.y()))
        && ((inter.z()>=box_min.z()) && (inter.z() <box_max.z()))
        ){
            return true;
        }
        return false;
}
开发者ID:GodZza,项目名称:contours,代码行数:9,代码来源:Grid.cpp

示例2: sphere_clip_vector

// precondition1: P is inside the sphere
// precondition2: P,V points to the outside of the sphere (i.e. OP.V > 0)
static bool sphere_clip_vector(const Vec3r& O, real r, const Vec3r& P, Vec3r& V)
{
	Vec3r W = P - O;
	real a = V.squareNorm();
	real b = 2.0 * V * W;
	real c = W.squareNorm() - r * r;
	real delta = b * b - 4 * a * c;
	if (delta < 0) {
		// Should not happen, but happens sometimes (numerical precision)
		return true;
	}
	real t = - b + ::sqrt(delta) / (2.0 * a);
	if (t < 0.0) {
		// Should not happen, but happens sometimes (numerical precision)
		return true;
	}
	if (t >= 1.0) {
		// Inside the sphere
		return false;
	}

	V[0] = (t * V.x());
	V[1] = (t * V.y());
	V[2] = (t * V.z());

	return true;
}
开发者ID:Ichthyostega,项目名称:blender,代码行数:29,代码来源:Curvature.cpp

示例3: acos

real CurvePoint::curvature2d_as_angle() const
{
#if 0
	Vec3r edgeA = (_FEdges[0])->orientation2d();
	Vec3r edgeB = (_FEdges[1])->orientation2d();
	Vec2d N1(-edgeA.y(), edgeA.x());
	N1.normalize();
	Vec2d N2(-edgeB.y(), edgeB.x());
	N2.normalize();
	return acos((N1 * N2));
#endif
	if (__A == 0)
		return __B->curvature2d_as_angle();
	if (__B == 0)
		return __A->curvature2d_as_angle();
	return ((1 - _t2d) * __A->curvature2d_as_angle() + _t2d * __B->curvature2d_as_angle());
}
开发者ID:diekev,项目名称:blender,代码行数:17,代码来源:Curve.cpp

示例4: ComputeBarycentricCoords

// assume the point is inside the triangle
Vec3r ComputeBarycentricCoords(const Vec3r A,const Vec3r B,const Vec3r C,const Vec3r P)
{
  Vec3r BA = B-A;
  Vec3r CA = C-A;
  Vec3r N = BA^CA;
  
  Vec3r PA = A-P;
  Vec3r PB = B-P;
  Vec3r PC = C-P;

  double areaA = (PB^PC) * N;
  double areaB = (PC^PA) * N;
  double areaC = (PA^PB) * N;

#if 0
  // checking
  printf("Barycentric debug: ----------------------------------\n");
  printf("A = [%f %f %f], B = [%f %f %f], C = [%f %f %f]\n",
	 A.x(), A.y(), A.z(),	 B.x(), B.y(), B.z(),	 C.x(), C.y(), C.z());
  printf("P = [%f %f %f]\n", P.x(), P.y(), P.z());
  printf("areas = [%f %f %f]\n", areaA, areaB, areaC);
  printf("plot3([%f %f %f %f],[%f %f %f %f],[%f %f %f %f],'r-');\n",
	 A.x(), B.x(), C.x(), A.x(),
	 A.y(), B.y(), C.y(), A.y(),
	 A.z(), B.z(), C.z(), A.z());
  printf("hold on; plot3(%f,%f,%f,'bo');\n",
	 P.x(),P.y(),P.z());
#endif


  assert(areaA > -0.1 && areaB > -0.1 && areaC > -0.1);
  if (areaA < 0)
    areaA = 0;
  if (areaB < 0)
    areaB = 0;
  if (areaC < 0)
    areaC = 0;

  double totalArea = areaA + areaB + areaC;

  double a = areaA / totalArea;
  double b = areaB / totalArea;
  double c = areaC / totalArea;


  //  printf("c = [%f %f %f]\n", a,b,c);

  Vec3r result(a,b,c);

  return result;
}
开发者ID:GodZza,项目名称:contours,代码行数:52,代码来源:GeomUtils.cpp

示例5: intersectRayBBox

    bool intersectRayBBox(const Vec3r& orig, const Vec3r& dir,   // ray origin and direction
        const Vec3r& boxMin, const Vec3r& boxMax, // the bbox
        real t0, real t1,
        real& tmin, real& tmax,                  // I0=orig+tmin*dir is the first intersection, I1=orig+tmax*dir is the second intersection
        real epsilon){

            float tymin, tymax, tzmin, tzmax;
            Vec3r inv_direction(1.0/dir[0], 1.0/dir[1], 1.0/dir[2]);
            int sign[3];
            sign[0] = (inv_direction.x() < 0);
            sign[1] = (inv_direction.y() < 0);
            sign[2] = (inv_direction.z() < 0);

            Vec3r bounds[2];
            bounds[0] = boxMin;
            bounds[1] = boxMax;

            tmin = (bounds[sign[0]].x() - orig.x()) * inv_direction.x();
            tmax = (bounds[1-sign[0]].x() - orig.x()) * inv_direction.x();
            tymin = (bounds[sign[1]].y() - orig.y()) * inv_direction.y();
            tymax = (bounds[1-sign[1]].y() - orig.y()) * inv_direction.y();
            if ( (tmin > tymax) || (tymin > tmax) )
                return false;
            if (tymin > tmin)
                tmin = tymin;
            if (tymax < tmax)
                tmax = tymax;
            tzmin = (bounds[sign[2]].z() - orig.z()) * inv_direction.z();
            tzmax = (bounds[1-sign[2]].z() - orig.z()) * inv_direction.z();
            if ( (tmin > tzmax) || (tzmin > tmax) )
                return false;
            if (tzmin > tmin)
                tmin = tzmin;
            if (tzmax < tmax)
                tmax = tzmax;
            return ( (tmin < t1) && (tmax > t0) );
        }
开发者ID:GodZza,项目名称:contours,代码行数:37,代码来源:GeomUtils.cpp

示例6: WorldToImage

Vec2r SilhouetteGeomEngine::WorldToImage2(const Vec3r & M)
{
  Vec3r newPoint = WorldToImage(M);
  return Vec2r(newPoint.x(), newPoint.y());
}
开发者ID:GodZza,项目名称:contours,代码行数:5,代码来源:SilhouetteGeomEngine.cpp


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