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


C++ sphere类代码示例

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


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

示例1: shape

sphere::sphere(sphere const& other) :
shape(other.name(), other.Color()),
center_(other.center()),
radius_(other.radius())
{
	// cout << "sphere copy c'tor" << endl;
}
开发者ID:sqrt,项目名称:plse-beleg-6,代码行数:7,代码来源:sphere.cpp

示例2: OnD3D11DestroyDevice

//--------------------------------------------------------------------------------------
// Release D3D11 resources created in OnD3D11CreateDevice 
//--------------------------------------------------------------------------------------
void CALLBACK OnD3D11DestroyDevice( void* pUserContext )
{
    g_DialogResourceManager.OnD3D11DestroyDevice();
    g_D3DSettingsDlg.OnD3D11DestroyDevice();
    //CDXUTDirectionWidget::StaticOnD3D11DestroyDevice();
    DXUTGetGlobalResourceCache().OnDestroyDevice();
	test.destroy();
	tessplane.destroy();
	lightsphere.destroy();
	tesscube.destroy();
	fuse.destroy();
	deboard.destroy();
	board1.destroy();
	geo_alien.destroy();
	FirePart.destroy();
    SAFE_DELETE( g_pTxtHelper );
	SAFE_RELEASE(g_DepthState);
    //g_Mesh11.Destroy();
    //            
    //SAFE_RELEASE( g_pVertexLayout11 );
    //SAFE_RELEASE( g_pVertexBuffer );
    //SAFE_RELEASE( g_pIndexBuffer );
    //SAFE_RELEASE( g_pVertexShader );
    //SAFE_RELEASE( g_pPixelShader );
    //SAFE_RELEASE( g_pSamLinear );

 /*   SAFE_RELEASE( g_pcbVSPerObject );
    SAFE_RELEASE( g_pcbPSPerObject );
    SAFE_RELEASE( g_pcbPSPerFrame );*/
}
开发者ID:AlexKLM,项目名称:DX11-Shader-Language-Coursework,代码行数:33,代码来源:BasicHLSL11.cpp

示例3: intersect

        //! Intersect with a sphere, returning true if there is an intersection.
        bool intersect(const sphere<Type>& s) const
        {
            const Type d1 = (s.getCenter() - m_center).sqrLength();
            const Type d2 = m_radius + s.getRadius();

            return (d1 < d2 * d2);
        }
开发者ID:mojocorp,项目名称:gtl,代码行数:8,代码来源:sphere.hpp

示例4: if

	bool bounding_box::contains(const sphere & sphere) const
	{
		const math::box & box = bounding_box::get_box();
		const math::point & min = box.get_min();
		const math::point & max = box.get_max();
		float sq_dist = 0.f;

		int matches = 0;

		for (int i = 0; i < 3; i++)
		{
			float v = sphere.get_origin()[i];

			if (v < min[i])
			{
				sq_dist += std::pow(min[i] - v, 2);
			}
			else if (v > max[i])
			{
				sq_dist += std::pow(v - max[i], 2);
			}
			else if (v >= min[i] + sphere.get_radius()
				&& v <= max[i] - sphere.get_radius())
			{
				matches++;
			}
		}

		return matches == 3;
	}
开发者ID:levka17,项目名称:Engine-Editor,代码行数:30,代码来源:collision.cpp

示例5: sphere

sphere sphere::operator +(const sphere& other) const
{
	glm::vec4 center = (c + other.getCenter()) * 0.5f;

	float radius = glm::distance(c, center) + glm::max(r, other.getRadius());

	return sphere(center, radius);
}
开发者ID:EddyGun,项目名称:Vulkan,代码行数:8,代码来源:sphere.cpp

示例6:

 bool triangle<T,color_type>::intersects(const sphere<T,color_type>& s) const
 {
     // If any of the 3 corners is inside the sphere, the triangle intersects.
     if (s.inside( plane<T,color_type>::get_origin()) ||
         s.inside( plane<T,color_type>::get_origin() + plane<T,color_type>::get_u_vector()) ||
         s.inside( plane<T,color_type>::get_origin() + plane<T,color_type>::get_v_vector()))
     {
         return true;
     }
     return false;
 }
开发者ID:bartholomule,项目名称:amethyst,代码行数:11,代码来源:triangle.hpp

示例7: extendBy

        //! Extend the boundaries of the sphere by the given sphere.
        void extendBy(const sphere<Type>& sphere)
        {
            if (intersect(sphere))
                return;

            const vec3<Type> dir = (m_center - sphere.getCenter()).normalized();
            const vec3<Type> p1 = m_center + m_radius * dir;
            const vec3<Type> p2 = sphere.getCenter() - sphere.getRadius() * dir;

            setPoles(p1, p2);
        }
开发者ID:mojocorp,项目名称:gtl,代码行数:12,代码来源:sphere.hpp

示例8: shiftCtrlP

inline sphere<T,N> shiftCtrlP(const sphere<T,N>& a,
                              const vec<T,N>& mpos,
                              const vec<T,N>& mshift,
                              const vec<T,N>& mindim,
                              const uint8_t * mask)
{
    if (mask) {
        if (pnw::get_bit(*mask, 0)) { a.c() += mshift; }
        if (pnw::get_bit(*mask, 1)) { a.r() -= dot(normalize(a.c() - mpos), mshift); }
    }
    return a;
}
开发者ID:,项目名称:,代码行数:12,代码来源:

示例9: intersects

	bool bbox::intersects(const sphere& s) const
	{
		const vec3& center(s.center());
		float radius(s.radius());

		return ((center.x >= mn.x && (mn.x - center.x) <= radius) &&
			(center.x <= mx.x && (center.x - mx.x) <= radius) &&
			(center.y >= mn.y && (mn.y - center.y) <= radius) &&
			(center.y <= mx.y && (center.y - mx.y) <= radius) &&
			(center.z >= mn.z && (mn.z - center.z) <= radius) &&
			(center.z <= mx.z && (center.z - mx.z) <= radius));
	}
开发者ID:SergeyShatalov,项目名称:ssh,代码行数:12,代码来源:ssh_math.cpp

示例10: getRel

/*! Inverse Operation of \c sphere<T,N>_getSub(). */
inline sphere<T,N> getRel(const box<T,N>& a,
                          const sphere<T,N>& b)
{
    auto ad = a.dim();
    sphere<T,N> ba((b.c() - a.l()) / ad,
                   b.r() / pnw::mean(ad(0), ad(1), ad(2)));
    if (ad(0) != ad(1) or
        ad(1) != ad(2) or
        ad(2) != ad(0)) {
        PTODO("ad's components not all equal => may result in an ellipse\n");
    }
    return ba;
}
开发者ID:,项目名称:,代码行数:14,代码来源:

示例11: ad

/*! Inverse Operation of \c sphere<T,N>_getSub_box2f(). */
inline void
sphere<T,N>_getRel_box2f(const box2f& a,
                         const sphere<T,N>& b,
                         sphere<T,N>& ba)
{
    vec2f ad; box2f_rdDim(a, &ad);
    vec3f_set(&ba.c(),
              (b.c()(0) - a.l(0)) / ad(0),
              (b.c()(1) - a.l(1)) / ad(1),
              b.c()(2));		/* z is ignored */
    ba.r() = b.r() / mean(ad(0), ad(1));
    if (ad(0) != ad(1)) {
        PTODO("ad's components not all equal => may result in an ellipse\n");
    }
}
开发者ID:,项目名称:,代码行数:16,代码来源:

示例12: isVisible

VkBool32 frustum::isVisible(const sphere& sphereWorld) const
{
	float distance;

	for (auto& currentSide : sidesWorld)
	{
		distance = currentSide.distance(sphereWorld.getCenter());

		if (distance + sphereWorld.getRadius() < 0.0f)
		{
			return VK_FALSE;
		}
	}

	return VK_TRUE;
}
开发者ID:YoutaVen,项目名称:Vulkan,代码行数:16,代码来源:frustum.cpp

示例13: extendBy

void
plane::
extendBy ( const sphere& sphereIn )
{
	if ( !sphereIn.isEmpty() )
	{
		vec3 pos ( math::vec3::NoInit );
		ValueType radius;
		sphereIn.get ( pos, radius );
		vec3 dir = normal;
		dir.normalize ();
		vec3 pt = pos + dir * radius;
		extendBy ( pt );
		pt = pos - dir * radius;
		extendBy ( pt );
	}
}
开发者ID:prwhite,项目名称:philibs,代码行数:17,代码来源:pniplane.cpp

示例14: intersect_sphere

hit_test intersect_sphere (ray r, sphere s)
{
  hit_test result = {0};
  v3 sc = s.center;
  double sr = s.radius;
  v3 a = v3_sub(r.origin, sc);
  double b = v3_dot(a, r.direction);
  double c = v3_dot(a, a) - (sr * sr);
  double d = (b * b) - c;
  double t = -b - sqrt(d);
  result.miss = MISS;
  if (d > 0 && t > 0) {
    v3 intersection = ray_position(r, t);  
    result.miss = HIT;
    result.t = t;
    result.hit_point = intersection;
    result.surf = s.surface_color(sc, intersection);
    result.shine = s.shine;
    result.surf_norm = v3_norm(v3_sub(intersection, sc));
  }
  return result;
}
开发者ID:nsetton,项目名称:Ray-Tracer-Project,代码行数:22,代码来源:intersect.c

示例15: extendBy

void
sphere::
extendBy ( const sphere& sphere )
{
	if ( this == &sphere )
		return;					// no extend by self.

	if ( sphere.isEmpty () )
		return;					// do nothing with empty spheres

	if ( isEmpty () )
	{
		*this = sphere;
	}
	else
	{
      // this finds the vector seperating this and sphere and add to
      // the length the radius of the other sphere to get a point on
      // the far side of sphere... it then calls extendBy with the
      // calculated point

		vec3 diff ( sphere.center );
		diff -= center;

		ValueType diffLen = diff.length ();

		diff /= diffLen;

		diffLen += sphere.radius;

		diff *= diffLen;

		diff += center;

		extendBy ( diff );
	}
}
开发者ID:prwhite,项目名称:philibs,代码行数:37,代码来源:pnisphere.cpp


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