• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ Normal函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: uniform_sphere_sample

 Point SphereShape::sample_point(float u1, float u2,
     Normal& out_n, float& out_ray_epsilon) const 
 {
   Vec3 w = uniform_sphere_sample(u1, u2);
   out_n = Normal(w);
   out_ray_epsilon = 5e-3f * this->radius;
   return Point() + Vector(w * this->radius);
 }
开发者ID:honzasp,项目名称:dort,代码行数:8,代码来源:sphere_shape.cpp


示例2: Compound

// ---------------------------------------------------------------- copy constructor
SolidCylinder::SolidCylinder(const SolidCylinder& cyl) 
	:	Compound(cyl),
		bottom(cyl.bottom),
		top(cyl.top),
		radius(cyl.radius),
		box(Point3D(-1.0*radius,bottom , -1.0*radius),
			Point3D(1.0*radius,top , 1.0*radius))

{objects.push_back(new Disk(Point3D(0, bottom, 0),
						Normal(0, -1, 0),
						radius));

	objects.push_back(new Disk(Point3D(0, top, 0),
						Normal(0, 1, 0),
						radius));

	objects.push_back(new OpenCylinder(bottom,top,radius));}
开发者ID:koolkalang,项目名称:RayTracer,代码行数:18,代码来源:SolidCylinder.cpp


示例3: Normal

Vector2D Vector2D::Reflect(const Vector2D & v, const Vector2D &a) {
	Vector2D n = Normal(a);
	float co = -2 * ((float)v.Dot(n) / (n.Magnitude() * n.Magnitude()));
	Vector2D r = {};
	r.x = v.x + co * n.x;
	r.y = r.y + co * n.y;
	return r;
}
开发者ID:SimpleManGames,项目名称:DirectEngine,代码行数:8,代码来源:Vector2D.cpp


示例4: rotate

D3DXVECTOR3 rotate(D3DXVECTOR3 v, Quaternion q) {
	Quaternion q_, qv;
	q = Normal(q);
	q_.w = q.w; q_.x = -q.x; q_.y = -q.y; q_.z = -q.z;
	qv.w = 0; qv.x=v.x; qv.y=v.y; qv.z=v.z;
	Quaternion aa= q_*qv*q;
	return D3DXVECTOR3(aa.x, aa.y, aa.z);
}
开发者ID:poigwym,项目名称:3DstudentSystem,代码行数:8,代码来源:Quaternion.cpp


示例5: Lerp

Point Cylinder::Sample(float u1, float u2, Normal *Ns) const {
    float z = Lerp(u1, zmin, zmax);
    float t = u2 * phiMax;
    Point p = Point(radius * cosf(t), radius * sinf(t), z);
    *Ns = Normalize((*ObjectToWorld)(Normal(p.x, p.y, 0.)));
    if (ReverseOrientation) *Ns *= -1.f;
    return (*ObjectToWorld)(p);
}
开发者ID:ChiahungTai,项目名称:ray-hierarchy-,代码行数:8,代码来源:cylinder.cpp


示例6: DoesIntersect

bool DistanceEstimator::Intersect(const Ray &r, float *tHit, float *rayEpsilon,
    DifferentialGeometry *dg) const {
  bool succeed = DoesIntersect(r, tHit);
  if (!succeed) return false;

  Ray ray;
  (*WorldToObject)(r, &ray);
  Point p = ray(*tHit);
  *rayEpsilon = DE_params.hitEpsilon * DE_params.rayEpsilonMultiplier;
  Vector n = CalculateNormal(p, DE_params.normalEpsilon);
  Vector DPDU, DPDV;
  CoordinateSystem(n, &DPDU, &DPDV);

  const Transform &o2w = *ObjectToWorld;
  *dg = DifferentialGeometry(o2w(p), o2w(DPDU), o2w(DPDV), Normal(), Normal(), 0, 0, this);
  return true;
}
开发者ID:csimstu,项目名称:pbrt-v2,代码行数:17,代码来源:distanceestimator.cpp


示例7: SCDebugPrint

Point3 SContext::DP(void)
{
	SCDebugPrint("SContext::DP\n");

	float d = (1.0f+DFACT)*0.1f/(DFACT+(float)fabs(DotProd(Normal(),viewDir)));
	dp = Point3(d,d,d);
	return dp;
}
开发者ID:DimondTheCat,项目名称:xray,代码行数:8,代码来源:scontext.cpp


示例8: FileGetZeroedChunk

boolean FileGetZeroedChunk (vbntype       VbnBlk,    blkhdrtype *BlkHdr, 
                            boolean       Release,   
                            ft F,lt Z,zz *Status,    numtype    *Chunk)  
{
bytessize   UnitSize     = 0;
indextype   UnitCount    = 0;
bytessize   ChunkSize    = 0;
vbntype     ChunkRefVbn  = VbnBlk;
chunkstruc  ChunkRef; 
chunkstruc *ChunkRefPtr  = &ChunkRef;
addrtype    ChunkAddr    = NullPtr;

  /* Load Chunk Struc Into Core                                            */
  if (FileInBlk ((addrtype *)&ChunkRefPtr,              sizeof(chunkstruc),
                 BlkHdr,      Release,     McStat,     &ChunkRefVbn))
  {
     UnitSize  = ChunkRefPtr->UnitSize;
     UnitCount = ChunkRefPtr->UnitCount;
     ChunkSize = UnitCount * UnitSize;

     if (!*Chunk)
        MemMakeChunk (UnitSize,  UnitCount, ChunkRef.ExtendQty,
                      DbmDbId,   McStat,    Chunk);

     if (Normal(*Status))
        MemPutStackPtr (*Chunk, ChunkRef.StackPtr, McStat);


     if (!ChunkSize)
     if (sprintf (Msg, TraceStr(43),
/* "    ZERO BLOCK [%3u] ZERO Chunk[%4u](%2u * %2u)\n" */
                  VbnBlk, *Chunk, UnitCount, UnitSize))
        TraceMsg (0, Msg);

     if (MemGetChunkAddr (*Chunk,     McStat,      &ChunkAddr))
        memset           (ChunkAddr,  NULL,    (size_t )ChunkSize);
  }

  if (Normal(*Status))
  if (DeBug)
      MemDumpChunk   (0,                 *Chunk,         McStat);

TRACK(TrackBak,"FileGetZeroedChunk\n");
return(STAT);
}
开发者ID:palmerc,项目名称:lab,代码行数:45,代码来源:fm.c


示例9: PrependTabs

void CBasePoly::SaveBasePolyLTA( CLTAFile* pFile, uint32 level )
{
	uint32		i;

	//write out the list of face indices
	PrependTabs(pFile, level);
	pFile->WriteStr("( f ");
	for( i=0; i < m_Indices; i++ ){
		pFile->WriteStrF("%i ", m_Indices[i] );
	}
	pFile->WriteStr(")");
	
	//write out the surface normal
	PrependTabs(pFile, level);
	pFile->WriteStrF("( n %f %f %f )", Normal().x, Normal().y, Normal().z );
	PrependTabs(pFile, level);
	pFile->WriteStrF("( dist %f )", Dist() );
}
开发者ID:Joincheng,项目名称:lithtech,代码行数:18,代码来源:BasePoly.cpp


示例10: Student

   double Student(long n)
/* =========================================== 
 * Returns a student-t distributed real number.
 * NOTE: use n > 0
 * ===========================================
 */
{
  return (Normal(0.0, 1.0) / sqrt(Chisquare(n) / n));
}
开发者ID:code4bones,项目名称:crawlpaper,代码行数:9,代码来源:rvgs.c


示例11: Lognormal

   double Lognormal(double a, double b)
/* ==================================================== 
 * Returns a lognormal distributed positive real number. 
 * NOTE: use b > 0.0
 * ====================================================
 */
{
  return (exp(a + b * Normal(0.0, 1.0)));
}
开发者ID:code4bones,项目名称:crawlpaper,代码行数:9,代码来源:rvgs.c


示例12: sampleEmissionArea

	void sampleEmissionArea(EmissionRecord &eRec, const Point2 &sample) const {
		if (eRec.type == EmissionRecord::ENormal) {
			Vector d = squareToSphere(sample);
			eRec.sRec.p = m_bsphere.center + d * m_bsphere.radius;
			eRec.sRec.n = Normal(-d);
			eRec.pdfArea = 1.0f / (4 * M_PI * m_bsphere.radius * m_bsphere.radius);
			eRec.value = Spectrum(M_PI);
		} else {
			/* Preview mode, which is more suitable for VPL-based rendering: approximate 
			   the infinitely far-away source with set of diffuse point sources */
			const Float radius = m_bsphere.radius * 1.5f;
			Vector d = squareToSphere(sample);
			eRec.sRec.p = m_bsphere.center + d * radius;
			eRec.sRec.n = Normal(-d);
			eRec.pdfArea = 1.0f / (4 * M_PI * radius * radius);
			eRec.value = Le(d) * M_PI;
		}
	}
开发者ID:joewan,项目名称:mitsuba-renderer,代码行数:18,代码来源:sky.cpp


示例13: samplePosition

	void samplePosition(PositionSamplingRecord &pRec, const Point2 &sample) const {
		const Transform &trafo = m_objectToWorld->eval(pRec.time);
		Point2 p = warp::squareToUniformDiskConcentric(sample);

		pRec.p = trafo(Point3(p.x, p.y, 0));
		pRec.n = normalize(trafo(Normal(0, 0, 1)));
		pRec.pdf = m_invSurfaceArea;
		pRec.measure = EArea;
	}
开发者ID:AdrianJohnston,项目名称:ShapeNetRender,代码行数:9,代码来源:disk.cpp


示例14: samplePosition

	Spectrum samplePosition(PositionSamplingRecord &pRec,
			const Point2 &sample, const Point2 *extra) const {
		const Transform &trafo = m_worldTransform->eval(pRec.time);
		pRec.p = trafo(Point(0.0f));
		pRec.n = Normal(0.0f);
		pRec.pdf = 1.0f;
		pRec.measure = EDiscrete;
		return Spectrum(1.0f);
	}
开发者ID:dkoerner,项目名称:mitsuba,代码行数:9,代码来源:spherical.cpp


示例15: IntersectionPoint

void IntersectionPoint(const Circle& c1, const Circle& c2, Point& p1, Point& p2)
{
    double d = Length(c1.c - c2.c);
    double l = (c1.r*c1.r + d*d - c2.r*c2.r) / (2 * d);
    double h = sqrt(c1.r*c1.r - l*l);
    Point mid = c1.c + unit(c2.c-c1.c) * l;
    Vector t = Normal(c2.c - c1.c) * h;
    p1 = mid + t;
    p2 = mid - t;
}
开发者ID:KiritoTRw,项目名称:OJ-Problems-Source,代码行数:10,代码来源:3467_autoAC.cpp


示例16: ConcentricSampleDisk

Point Disk::Sample(float u1, float u2, Normal *Ns) const {
    Point p;
    ConcentricSampleDisk(u1, u2, &p.x, &p.y);
    p.x *= radius;
    p.y *= radius;
    p.z = height;
    *Ns = Normalize((*ObjectToWorld)(Normal(0,0,1)));
    if (ReverseOrientation) *Ns *= -1.f;
    return (*ObjectToWorld)(p);
}
开发者ID:AlexanderChiang,项目名称:SeniorThesis,代码行数:10,代码来源:disk.cpp


示例17: mlStrcmpEnd

int mlStrcmpEnd(char* string1, char* string2)
{
	int i = 0, len1 = 0, len2 = 0;
	while (string1[i] != '\r' && string1[i] != 'ý')
	{
		i++;
	}
	int j = 0;
	while (string2[j] != '\r' && string1[i] != 'ý')
	{
		j++;
	}

	len1 = i;
	len2 = j;
	
	i = 1;
	j = 1;

	if (string2[len2 - 1] >= 'A' && string2[len2 - 1] <= 'Z' && string1[len1 - 1] >= 'A' && string1[len1 - 1] <= 'Z')
		return 0;
	else while (len1 - i >= 0 && len2 - j >= 0)
	{
		if (!Normal(string1, i))
			i++;
		if (!Normal(string2, j))
			j++;
		if (Normal(string1, i) && Normal(string2, j))
		{
			if (string1[len1 - i] == string2[len2 - j])
			{
				i++;
				j++;
			}
			else if (string1[len1 - i] > string2[len2 - j])
				return 1;
			else if (string1[len1 - i] < string2[len2 - j])
				return -1;
			else return 0;
		}
	}
	return 0;
}
开发者ID:vova98,项目名称:Isengreem,代码行数:43,代码来源:stdafx.cpp


示例18: uniform_sphere_sample

 Spectrum PointLight::sample_ray_radiance(const Scene&, 
     Ray& out_ray, Normal& out_nn, float& out_pdf,
     LightRaySample sample) const
 {
   Vec3 wi = uniform_sphere_sample(sample.uv_dir.x, sample.uv_dir.y);
   out_ray = Ray(this->pt, Vector(wi), 0.f);
   out_nn = Normal(wi);
   out_pdf = uniform_sphere_pdf();
   return this->intensity;
 }
开发者ID:honzasp,项目名称:dort,代码行数:10,代码来源:point_light.cpp


示例19: Distance

bool plane_t::PlaneLineIntersection(vec3 start, vec3 end, vec3 *hitpoint)
{
	float d1, d2;

	d1 = Distance(start);
	d2 = Distance(end);

	if (d1 == d2)
	{
		return false;
	}

	if (d1 > 0.0f && d2 > 0.0f)
	{
		return false;
	}

	if (d1 < 0.0f && d2 < 0.0f)
	{
		return false;
	}

	// calculate the intersection
	{
		float fraction;
		fraction = (d1 / (d1 - d2));

		*hitpoint = start + fraction * (start - end);
		return true;
	}

#if 0
	// calculate a more precise intersection
	{
		// this will only work if the normal is normalized
		vec3 n = Normal();
		fraction = (d1 / (d1 - d2));
		for(i = 0; i < 3; i++)
		{
			if (n[i] == 1)
			{
				hitpoint[i] = d;
			}
			else if (n[i] == -1)
			{
				hitpoint[i] = -d;
			}
			else
			{
				hitpoint[i] = start[i] + fraction * (start[i] - end[i]);
			}
		}
	}
#endif
}
开发者ID:brycekelleher,项目名称:bsp,代码行数:55,代码来源:plane.cpp


示例20: Is_List01Member

/*     14.1.5                                                             */
boolean Is_List01Member  (tokentype    *ListTkn,   tokentype    *MemberTkn,
                          ft F,lt Z,zz *Status,    tokentype    *NodeTkn)
{
listheadtype *HeadObj         = NullPtr;
tokentype     NextNode        = NullToken;
listnodetype *NodeObj         = NullPtr;

  NextNode.DbId   = ListTkn->DbId;

  if (ListBug || DeBug)
  if (sprintf (Msg, "\n   Is_List01Member[%4u:%6u]:: Token=[%2u:%4u]  \n",
               ListTkn->DbId,    ListTkn->Handle,
               MemberTkn->DbId,  MemberTkn->Handle))
     TraceMsg (0, Msg);

  if (OaGetObject (ListTkn,   McStat,   (addrtype *)&HeadObj))
  for (NextNode.Handle  = HeadObj->FirstNode; 
       Normal(*Status) && NextNode.Handle;)
  {
     if (OaGetObject (&NextNode,   McStat,   (addrtype *)&NodeObj))
     if (NodeObj->NodeObject.Handle == MemberTkn->Handle
     &&  NodeObj->NodeObject.DbId   == MemberTkn->DbId)
     {
        if (ListBug || DeBug)
        if (sprintf (Msg, "     ...NodeTkn =[%4u:%6u]\n",
                     NodeTkn->DbId, NodeTkn->Handle))
           TraceMsg (0, Msg);

        return (True);

     } else
        NextNode.Handle = NodeObj->NextNode;
  }
  if (ListBug || DeBug)
     TraceMsg (0, "\n   ... Not a Member.\n");

  if (Normal(*Status))
     return (False);

TRACK(TrackBak,"Is_List01Member\n");
return (STAT);
}
开发者ID:shivgarg,项目名称:SPEC_CPU_BENCH-2000-Android-APP,代码行数:43,代码来源:list01.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ Normalize函数代码示例发布时间:2022-05-30
下一篇:
C++ Nop函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap