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


C++ Dot函数代码示例

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


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

示例1: HosekWilkieSky

    TextureResult HosekWilkieSky(const BufferUploads::TextureDesc& desc, const ParameterBox& parameters)
    {
            // The "turbidity" parameter is Linke’s turbidity factor. Hosek and Wilkie give these example parameters:
            //      T = 2 yields a very clear, Arctic-like sky
            //      T = 3 a clear sky in a temperate climate
            //      T = 6 a sky on a warm, moist day
            //      T = 10 a slightly hazy day
            //      T > 50 represent dense fog

        auto defaultSunDirection = Normalize(Float3(1.f, 1.f, 0.33f));
        Float3 sunDirection = parameters.GetParameter<Float3>(ParameterBox::ParameterNameHash("SunDirection"), defaultSunDirection);
        sunDirection = Normalize(sunDirection);

        auto turbidity = (double)parameters.GetParameter(ParameterBox::ParameterNameHash("turbidity"), 3.f);
        auto albedo = (double)parameters.GetParameter(ParameterBox::ParameterNameHash("albedo"), 0.1f);
        auto elevation = (double)Deg2Rad(parameters.GetParameter(ParameterBox::ParameterNameHash("elevation"), XlASin(sunDirection[2])));
        auto* state = arhosek_rgb_skymodelstate_alloc_init(turbidity, albedo, elevation);

        auto pixels = std::make_unique<Float4[]>(desc._width*desc._height);
        for (unsigned y=0; y<desc._height; ++y)
            for (unsigned x=0; x<desc._width; ++x) {
                auto p = y*desc._width+x;
                pixels[p] = Float4(0.f, 0.f, 0.f, 1.f);

                Float3 direction(0.f, 0.f, 0.f);
                bool hitPanel = false;

                for (unsigned c = 0; c < 6; ++c) {
                    Float2 tc(x / float(desc._width), y / float(desc._height));
                    auto tcMins = s_verticalPanelCoords[c][0];
                    auto tcMaxs = s_verticalPanelCoords[c][1];
                    if (tc[0] >= tcMins[0] && tc[1] >= tcMins[1] && tc[0] <  tcMaxs[0] && tc[1] <  tcMaxs[1]) {
                        tc[0] = 2.0f * (tc[0] - tcMins[0]) / (tcMaxs[0] - tcMins[0]) - 1.0f;
                        tc[1] = 2.0f * (tc[1] - tcMins[1]) / (tcMaxs[1] - tcMins[1]) - 1.0f;

                        hitPanel = true;
                        auto plusX = s_verticalPanels[c][0];
                        auto plusY = s_verticalPanels[c][1];
                        auto center = s_verticalPanels[c][2];
                        direction = center + plusX * tc[0] + plusY * tc[1];
                    }
                }

                if (hitPanel) {
                    auto theta = CartesianToSpherical(direction)[0];
                    theta = std::min(.4998f * gPI, theta);
                    auto gamma = XlACos(std::max(0.f, Dot(Normalize(direction), sunDirection)));

                    auto R = arhosek_tristim_skymodel_radiance(state, theta, gamma, 0);
                    auto G = arhosek_tristim_skymodel_radiance(state, theta, gamma, 1);
                    auto B = arhosek_tristim_skymodel_radiance(state, theta, gamma, 2);

                    pixels[p][0] = (float)R;
                    pixels[p][1] = (float)G;
                    pixels[p][2] = (float)B;
                }
            }

        arhosekskymodelstate_free(state);

        return TextureResult
            {
                BufferUploads::CreateBasicPacket(
                    (desc._width*desc._height)*sizeof(Float4),
                    pixels.get(),
                    BufferUploads::TexturePitches(desc._width*sizeof(Float4), desc._width*desc._height*sizeof(Float4))),
                RenderCore::Metal::NativeFormat::R32G32B32A32_FLOAT,
                UInt2(desc._width, desc._height)
            };
    }
开发者ID:Clever-Boy,项目名称:XLE,代码行数:70,代码来源:HosekWilkie.cpp

示例2: Min

vec Plane::ProjectToPositiveHalf(const vec &point) const
{
	return point - Min(0.f, (Dot(normal, point) - d)) * normal;
}
开发者ID:Garfield-Chen,项目名称:tng,代码行数:4,代码来源:Plane.cpp

示例3: Dot

float Plane::DihedralAngle(const Plane &plane) const
{
	return Dot(normal, plane.normal);
}
开发者ID:Garfield-Chen,项目名称:tng,代码行数:4,代码来源:Plane.cpp

示例4: TransformPoint

	Vector2 TransformPoint(Mat3Param matrix, Vec2Param vector)
	{
		float x = Dot(*(Vector2*)&matrix[0], vector) + matrix[0][2];
		float y = Dot(*(Vector2*)&matrix[1], vector) + matrix[1][2];
		return Vector2(x, y);
	}
开发者ID:Reticulatas,项目名称:MochaEngineFinal,代码行数:6,代码来源:Matrix3.cpp

示例5: cos

void PerceptionModule::UpdatePerception()
{
	const float viewDistanceSqr = mViewDistance*mViewDistance;
	const float viewSpan = cos(mViewAngle * 0.5f);

	//const AgentList& agents = mOwner.GetWorld().GetAgentList();
	const std::vector<Agent*> agents = mOwner.GetWorld().GetAgents();

	//AgentList::const_iterator iter = agents.begin();
	int size = agents.size();
	//for(; iter!= agents.end(); ++iter)
	for (int i = 0; i < size; ++i)
	{
		const Agent* agent = agents[i]; //(*iter);
		// Ignore self
		if (&mOwner == agent)
		{
			continue;
		}

		// Check if agent is in range
		const SVector2 ownerToTarget = agent->GetPosition() - mOwner.GetPosition();
		const float distanceSqr = LengthSquared(ownerToTarget);
		if (distanceSqr > viewDistanceSqr)
		{
			continue;
		}

		// Check if agent is in view cone
		const SVector2 dirToTarget = Normalize(ownerToTarget);
		const float dot = Dot(mOwner.GetHeading(), dirToTarget);
		if (dot < viewSpan)
		{
			continue;
		}

		// Check if we have line of site
		if (!mOwner.GetWorld().HasLOS(mOwner.GetPosition(), agent->GetPosition()))
		{
			continue;
		}

		// Check if we have a record for this agent
		bool hasRecord = false;
		MemoryRecords::iterator memoryIter = mMemoryRecords.begin();
		while (memoryIter != mMemoryRecords.end())
		{
			PerceptionData& record = (*memoryIter);
			if (record.pAgent == agent)
			{
				record.lastSeenLocation = agent->GetPosition();
				record.lastRecordedTime = 0.0f;
				record.level = Confirm;
				hasRecord = true;
				break;
			}
			++memoryIter;
		}

		// Add a new record if agent is new
		if (!hasRecord)
		{
			PerceptionData newRecord;
			newRecord.pAgent = agent;
			newRecord.lastSeenLocation = agent->GetPosition();
			newRecord.lastRecordedTime = 0.0f;
			newRecord.level = Confirm;
			mMemoryRecords.push_back(newRecord);
		}
	}
}
开发者ID:bretthuff22,项目名称:AI,代码行数:71,代码来源:PerceptionModule.cpp

示例6: PlaneEquation

	Vec4f PlaneEquation(void) const
	{
		return Vec4f(Normal(), -Dot(Normal(), _point));
	}
开发者ID:AdamSimpson,项目名称:oglplus,代码行数:4,代码来源:grid.hpp

示例7: Normalize

Float MicrofacetReflection::Pdf(const Vector3f &wo, const Vector3f &wi) const {
    if (!SameHemisphere(wo, wi)) return 0;
    Vector3f wh = Normalize(wo + wi);
    return distribution->Pdf(wo, wh) / (4 * Dot(wo, wh));
}
开发者ID:tdapper,项目名称:pbrt-v3,代码行数:5,代码来源:reflection.cpp

示例8: Reflect

		void Reflect(const Vector2D &v,
			const Vector2D &normal, Vector2D *result)
		{
			*result = (v - (normal * Dot(v, normal) * 2.0f));
		}
开发者ID:JSandrew4,项目名称:FastGdk,代码行数:5,代码来源:Vector2DMath.cpp

示例9: Dot

void VoxelRenderer::Flush(RenderContext& renderContext,
                          const SceneConstants& sceneConstants)
{
    //  Set up global shader constants
    m_constants.projectionViewMatrix = sceneConstants.viewMatrix *
                                       sceneConstants.projectionMatrix;
    m_constants.clipPlane = sceneConstants.clipPlane;

    //  Calculate camera distances for all queued render ops
    float3 cameraPos = sceneConstants.cameraPos;
    for (size_t i = 0; i < m_renderOps.size(); ++i)
    {
        float3 diff = m_renderOps[i].position - cameraPos;
        m_renderOps[i].distance2 = Dot(diff, diff);
    }
    for (size_t i = 0; i < m_gapFillerRenderOps.size(); ++i)
    {
        float3 diff = m_gapFillerRenderOps[i].position - cameraPos;
        m_gapFillerRenderOps[i].distance2 = Dot(diff, diff);
    }
    for (size_t i = 0; i < m_transparentRenderOps.size(); ++i)
    {
        float3 diff = m_transparentRenderOps[i].position - cameraPos;
        m_transparentRenderOps[i].distance2 = Dot(diff, diff);
    }
    
    //  Sort by camera distance (front to back for opaque render ops,
    //  back to front for transparent)
    auto transparentSorter = [](const RenderOp& lhs, const RenderOp& rhs)
    {
        return lhs.distance2 > rhs.distance2;
    };
    auto opaqueSorter = [](const RenderOp& lhs, const RenderOp& rhs)
    {
        return lhs.distance2 < rhs.distance2;
    };
    std::sort(m_renderOps.begin(), m_renderOps.end(), opaqueSorter);
    std::sort(m_gapFillerRenderOps.begin(), m_gapFillerRenderOps.end(), opaqueSorter);
    std::sort(m_transparentRenderOps.begin(), m_transparentRenderOps.end(), transparentSorter);

    //  Finally time to draw them
    renderContext.PushDepthStencilState(m_shared->depthStencilState);
    for (size_t i = 0; i < m_renderOps.size(); i++)
    {
        Draw(m_renderOps[i]);
    }
    m_renderOps.clear();
    renderContext.PopDepthStencilState();

    renderContext.PushDepthStencilState(m_shared->fillGapsDepthStencilState);
    for (size_t i = 0; i < m_gapFillerRenderOps.size(); ++i)
    {
        Draw(m_gapFillerRenderOps[i]);
    }
    m_gapFillerRenderOps.clear();
    renderContext.PopDepthStencilState();

    renderContext.PushDepthStencilState(m_shared->transparentDepthStencilState);
    renderContext.PushBlendState(m_shared->blendState);
    for (size_t i = 0; i < m_transparentRenderOps.size(); i++)
    {
        Draw(m_transparentRenderOps[i]);
    }
    m_transparentRenderOps.clear();
    renderContext.PopBlendState();
    renderContext.PopDepthStencilState();
}
开发者ID:rengeln,项目名称:nyx,代码行数:67,代码来源:VoxelRenderer.cpp

示例10: FacePlane

bool Polyhedron::FaceContains(int faceIndex, const float3 &worldSpacePoint, float polygonThickness) const
{
	// N.B. This implementation is a duplicate of Polygon::Contains, but adapted to avoid dynamic memory allocation
	// related to converting the face of a Polyhedron to a Polygon object.

	// Implementation based on the description from http://erich.realtimerendering.com/ptinpoly/

	const Face &face = f[faceIndex];
	const std::vector<int> &vertices = face.v;

	if (vertices.size() < 3)
		return false;

	Plane p = FacePlane(faceIndex);
	if (FacePlane(faceIndex).Distance(worldSpacePoint) > polygonThickness)
		return false;

	int numIntersections = 0;

	float3 basisU = v[vertices[1]] - v[vertices[0]];
	basisU.Normalize();
	float3 basisV = Cross(p.normal, basisU).Normalized();
	mathassert(basisU.IsNormalized());
	mathassert(basisV.IsNormalized());
	mathassert(basisU.IsPerpendicular(basisV));
	mathassert(basisU.IsPerpendicular(p.normal));
	mathassert(basisV.IsPerpendicular(p.normal));

	float2 localSpacePoint = float2(Dot(worldSpacePoint, basisU), Dot(worldSpacePoint, basisV));

	const float epsilon = 1e-4f;

	float2 p0 = float2(Dot(v[vertices.back()], basisU), Dot(v[vertices.back()], basisV)) - localSpacePoint;
	if (Abs(p0.y) < epsilon)
		p0.y = -epsilon; // Robustness check - if the ray (0,0) -> (+inf, 0) would pass through a vertex, move the vertex slightly.
	for(size_t i = 0; i < vertices.size(); ++i)
	{
		float2 p1 = float2(Dot(v[vertices[i]], basisU), Dot(v[vertices[i]], basisV)) - localSpacePoint;
		if (Abs(p1.y) < epsilon)
			p0.y = -epsilon; // Robustness check - if the ray (0,0) -> (+inf, 0) would pass through a vertex, move the vertex slightly.

		if (p0.y * p1.y < 0.f)
		{
			if (p0.x > 1e-3f && p1.x > 1e-3f)
				++numIntersections;
			else
			{
				// P = p0 + t*(p1-p0) == (x,0)
				//     p0.x + t*(p1.x-p0.x) == x
				//     p0.y + t*(p1.y-p0.y) == 0
				//                 t == -p0.y / (p1.y - p0.y)

				// Test whether the lines (0,0) -> (+inf,0) and p0 -> p1 intersect at a positive X-coordinate.
				float2 d = p1 - p0;
				if (Abs(d.y) > 1e-5f)
				{
					float t = -p0.y / d.y;
					float x = p0.x + t * d.x;
					if (t >= 0.f && t <= 1.f && x > 1e-6f)
						++numIntersections;
				}
			}
		}
		p0 = p1;
	}

	return numIntersections % 2 == 1;
}
开发者ID:360degrees-fi,项目名称:tundra,代码行数:68,代码来源:Polyhedron.cpp

示例11: brancher


//.........这里部分代码省略.........
          (*it)->Properties(WEIGHT) = 1.0;
          (*it)->Properties(MULTIPLICITY) = 1.0;
          //save old local energy
          ValueType eold((*it)->Properties(LOCALENERGY));
          ValueType emixed(eold);

          W.R = (*it)->R;
          w_buffer.rewind();
          W.copyFromBuffer(w_buffer);
          Psi.copyFromBuffer(W,w_buffer);

          ValueType psi_old((*it)->Properties(SIGN));
          ValueType psi(psi_old);

          //create a 3N-Dimensional Gaussian with variance=1
          makeGaussRandom(deltaR);
          bool notcrossed(true);
          int nAcceptTemp(0);
          int nRejectTemp(0);

          int iat=0;
          while(notcrossed && iat<nat){

            PosType dr(g*deltaR[iat]+(*it)->Drift[iat]);
            PosType newpos(W.makeMove(iat,dr));
            RealType ratio(Psi.ratio(W,iat,dG,dL));

            if(ratio < 0.0) {//node is crossed, stop here
              notcrossed = false;
            } else {
      	      G = W.G+dG;
      	      RealType logGf = -0.5*dot(deltaR[iat],deltaR[iat]);
      	      
      	      ValueType vsq = Dot(G,G);
      	      ValueType scale = ((-1.0+sqrt(1.0+2.0*Tau*vsq))/vsq);
      	      dr = (*it)->R[iat]-newpos-scale*G[iat]; 
      	      //dr = (*it)->R[iat]-newpos-Tau*G[iat]; 
      	      RealType logGb = -oneover2tau*dot(dr,dr);
      	      
      	      //RealType ratio2 = pow(ratio,2)
      	      RealType prob = std::min(1.0,pow(ratio,2)*exp(logGb-logGf));
      	      if(Random() < prob) { 
      	        ++nAcceptTemp;
      	        W.acceptMove(iat);
      	        Psi.update2(W,iat);
      	        W.G = G;
      	        W.L += dL;
      	        //  (*it)->Drift = Tau*G;
      	        (*it)->Drift = scale*G;
      	      } else {
      	        ++nRejectTemp; 
      	        Psi.restore(iat);
      	      }
            } 
            ++iat;
          }

          if(notcrossed) {
            if(nAcceptTemp) {//need to overwrite the walker properties
      	      w_buffer.rewind();
      	      W.copyToBuffer(w_buffer);
      	      psi = Psi.evaluate(W,w_buffer);
      	      (*it)->R = W.R;
      	      (*it)->Properties(AGE) = 0;
                    //This is not so useful: allow overflow/underflow
      	      (*it)->Properties(LOGPSI) = log(fabs(psi));
开发者ID:digideskio,项目名称:qmcpack,代码行数:67,代码来源:DMCParticleByParticle.cpp

示例12: _NDF

double TorranceSparrowSpecular::_NDF(const Vector &N, const Vector &H) {
    double ndoth=Dot(N,H);
    double ndoth2=ndoth*ndoth;
    return exp(((ndoth2)-1)/(mM*mM*ndoth2))*(1/(M_PI*mM*mM*ndoth2*ndoth2));
}
开发者ID:mmoactrpg,项目名称:RayTracer,代码行数:5,代码来源:TorranceSparrowSpecular.cpp

示例13: L

Spectrum IGIIntegrator::Li(const Scene *scene,
		const RayDifferential &ray, const Sample *sample,
		   float *alpha) const {
	Spectrum L(0.);
	Intersection isect;
	if (scene->Intersect(ray, &isect)) {
		if (alpha) *alpha = 1.;
		Vector wo = -ray.d;
		// Compute emitted light if ray hit an area light source
		L += isect.Le(wo);
		// Evaluate BSDF at hit point
		BSDF *bsdf = isect.GetBSDF(ray);
		const Point &p = bsdf->dgShading.p;
		const Normal &n = bsdf->dgShading.nn;
		L += UniformSampleAllLights(scene, p, n,
					    wo, bsdf, sample,
					    lightSampleOffset, bsdfSampleOffset,
					    bsdfComponentOffset);
		// Compute indirect illumination with virtual lights
		u_int lSet = min(u_int(sample->oneD[vlSetOffset][0] * nLightSets),
		                 nLightSets-1);
		for (u_int i = 0; i < virtualLights[lSet].size(); ++i) {
			const VirtualLight &vl = virtualLights[lSet][i];
			// Add contribution from _VirtualLight_ _vl_
			// Ignore light if it's too close to current point
			float d2 = DistanceSquared(p, vl.p);
			//if (d2 < .8 * minDist2) continue;
			float distScale = SmoothStep(.8 * minDist2, 1.2 * minDist2, d2);
			// Compute virtual light's tentative contribution _Llight_
			Vector wi = Normalize(vl.p - p);
			Spectrum f = distScale * bsdf->f(wo, wi);
			if (f.Black()) continue;
			float G = AbsDot(wi, n) * AbsDot(wi, vl.n) / d2;
			Spectrum Llight = indirectScale * f * G * vl.Le /
				virtualLights[lSet].size();
			Llight *= scene->Transmittance(Ray(p, vl.p - p));
			// Possibly skip shadow ray with Russian roulette
			if (Llight.y() < rrThreshold) {
				float continueProbability = .1f;
				if (RandomFloat() > continueProbability)
					continue;
				Llight /= continueProbability;
			}
			static StatsCounter vlsr("IGI Integrator", "Shadow Rays to Virtual Lights"); //NOBOOK
			++vlsr; //NOBOOK
			if (!scene->IntersectP(Ray(p, vl.p - p, RAY_EPSILON,
					1.f - RAY_EPSILON)))
				L += Llight;
		}
		// Trace rays for specular reflection and refraction
		if (specularDepth++ < maxSpecularDepth) {
			Vector wi;
			// Trace rays for specular reflection and refraction
			Spectrum f = bsdf->Sample_f(wo, &wi,
						BxDFType(BSDF_REFLECTION | BSDF_SPECULAR));
			if (!f.Black()) {
				// Compute ray differential _rd_ for specular reflection
				RayDifferential rd(p, wi);
				rd.hasDifferentials = true;
				rd.rx.o = p + isect.dg.dpdx;
				rd.ry.o = p + isect.dg.dpdy;
				// Compute differential reflected directions
				Normal dndx = bsdf->dgShading.dndu * bsdf->dgShading.dudx +
					bsdf->dgShading.dndv * bsdf->dgShading.dvdx;
				Normal dndy = bsdf->dgShading.dndu * bsdf->dgShading.dudy +
					bsdf->dgShading.dndv * bsdf->dgShading.dvdy;
				Vector dwodx = -ray.rx.d - wo, dwody = -ray.ry.d - wo;
				float dDNdx = Dot(dwodx, n) + Dot(wo, dndx);
				float dDNdy = Dot(dwody, n) + Dot(wo, dndy);
				rd.rx.d = wi -
					dwodx + 2 * Vector(Dot(wo, n) * dndx +
						 dDNdx * n);
				rd.ry.d = wi -
					dwody + 2 * Vector(Dot(wo, n) * dndy +
						 dDNdy * n);
				L += scene->Li(rd, sample) * f * AbsDot(wi, n);
			}
			f = bsdf->Sample_f(wo, &wi,
					   BxDFType(BSDF_TRANSMISSION | BSDF_SPECULAR));
			if (!f.Black()) {
				// Compute ray differential _rd_ for specular transmission
				RayDifferential rd(p, wi);
				rd.hasDifferentials = true;
				rd.rx.o = p + isect.dg.dpdx;
				rd.ry.o = p + isect.dg.dpdy;

				float eta = bsdf->eta;
				Vector w = -wo;
				if (Dot(wo, n) < 0) eta = 1.f / eta;

				Normal dndx = bsdf->dgShading.dndu * bsdf->dgShading.dudx + bsdf->dgShading.dndv * bsdf->dgShading.dvdx;
				Normal dndy = bsdf->dgShading.dndu * bsdf->dgShading.dudy + bsdf->dgShading.dndv * bsdf->dgShading.dvdy;

				Vector dwodx = -ray.rx.d - wo, dwody = -ray.ry.d - wo;
				float dDNdx = Dot(dwodx, n) + Dot(wo, dndx);
				float dDNdy = Dot(dwody, n) + Dot(wo, dndy);

				float mu = eta * Dot(w, n) - Dot(wi, n);
				float dmudx = (eta - (eta*eta*Dot(w,n))/Dot(wi, n)) * dDNdx;
				float dmudy = (eta - (eta*eta*Dot(w,n))/Dot(wi, n)) * dDNdy;
//.........这里部分代码省略.........
开发者ID:EiffelOberon,项目名称:pbrt-v1,代码行数:101,代码来源:igi.cpp

示例14: one

RGB TorranceSparrowSpecular::_Fresnel(const Vector &wo, const Vector &H) {
    RGB one(1,1,1);
    RGB f0=mAlbedo*mScaleFactor;
    return f0+(one-f0)*pow(1-Dot(H,wo),5);
}
开发者ID:mmoactrpg,项目名称:RayTracer,代码行数:5,代码来源:TorranceSparrowSpecular.cpp

示例15: ColourFit

RangeFit::RangeFit( ColourSet const* colours, int flags ) 
  : ColourFit( colours, flags )
{
	// initialise the metric
	bool perceptual = ( ( m_flags & kColourMetricPerceptual ) != 0 );
	if( perceptual )
		m_metric = Vec3( 0.2126f, 0.7152f, 0.0722f );
	else
		m_metric = Vec3( 1.0f );

	// initialise the best error
	m_besterror = FLT_MAX;

	// cache some values
	int const count = m_colours->GetCount();
	Vec3 const* values = m_colours->GetPoints();
	float const* weights = m_colours->GetWeights();
	
	// get the covariance matrix
	Sym3x3 covariance = ComputeWeightedCovariance( count, values, weights );
	
	// compute the principle component
	Vec3 principle = ComputePrincipleComponent( covariance );

	// get the min and max range as the codebook endpoints
	Vec3 start( 0.0f );
	Vec3 end( 0.0f );
	if( count > 0 )
	{
		float min, max;
		
		// compute the range
		start = end = values[0];
		min = max = Dot( values[0], principle );
		for( int i = 1; i < count; ++i )
		{
			float val = Dot( values[i], principle );
			if( val < min )
			{
				start = values[i];
				min = val;
			}
			else if( val > max )
			{
				end = values[i];
				max = val;
			}
		}
	}
			
	// clamp the output to [0, 1]
	Vec3 const one( 1.0f );
	Vec3 const zero( 0.0f );
	start = Min( one, Max( zero, start ) );
	end = Min( one, Max( zero, end ) );

	// clamp to the grid and save
	Vec3 const grid( 31.0f, 63.0f, 31.0f );
	Vec3 const gridrcp( 1.0f/31.0f, 1.0f/63.0f, 1.0f/31.0f );
	Vec3 const half( 0.5f );
	m_start = Truncate( grid*start + half )*gridrcp;
	m_end = Truncate( grid*end + half )*gridrcp;
}
开发者ID:DaveHarrison,项目名称:OpenSGDevMaster,代码行数:63,代码来源:OSGSquishRangefit.cpp


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