Esempio n. 1
0
RealisticCamera::RealisticCamera(const AnimatedTransform &cam2world,
				 float hither, float yon, 
				 float sopen, float sclose, 
				 float fdis, float ad, string specfilename,
				 float fdag, Film *f)
	: Camera(cam2world, sopen, sclose, f), // pbrt-v2 does not specify hither and yon
	cliphiter(hither),
	clipyon(yon),
	shutteropen(sopen),
	shutterclose(sclose),
	film(f)
{
	filmdistance = fdis;	// the distance from film to the nearest lens

	// initial lens of data
	totallength = GetLensData(specfilename, filmdistance, lens);
	lensnum = lens.size();
	
	// for perspective
	GetTransformData(f, totallength, fdag, hither, yon,
		CameraToScreen, ScreenToRaster, RasterToCamera, RasterToScreen);

	Warning("totallenth: %f", totallength);
	Warning("lensnum: %i", lensnum);
	for (int i = 0; i < lensnum; i++){
		Warning("%f %f %f %f", lens[i].centerz, lens[i].radius, lens[i].nratio, lens[i].apradius);
	}

}
Esempio n. 2
0
void LineCutPosDialog::OnBnClickedOk()
{
	GetTransformData();

	/*
	//绘制圆柱
	{
		//得到半径和高度
		double radius = _wtof(m_A00.GetBuffer());
		double height = _wtof(m_A01.GetBuffer());

		m3dSolid = CreateCylinder(radius,height);
		if( m3dSolid == NULL )
			return;
	}
	*/

	//绘制管道

	double radius = _wtof(m_A00.GetBuffer());

	double startX = _wtof(m_A10.GetBuffer());
	double startY = _wtof(m_A11.GetBuffer());
	double startZ = _wtof(m_A12.GetBuffer());

	double endX = _wtof(m_A20.GetBuffer());
	double endY = _wtof(m_A21.GetBuffer());
	double endZ = _wtof(m_A22.GetBuffer());

	CreatePipe(AcGePoint3d(startX,startY,startZ),AcGePoint3d(endX,endY,endZ),radius);

	/*
	{
		acutPrintf(L"首先绘制线段\n");
		point = AcGePoint3d(x,y,z);
		ArxWrapper::createLine(AcGePoint3d(),point,L"测试矩阵旋转");
	}

	//首先进行旋转
	{
		//AcGeMatrix3d rotateMatrix = AcGeMatrix3d::alignCoordSys(AcGePoint3d::kOrigin,AcGeVector3d::kXAxis,AcGeVector3d::kYAxis,AcGeVector3d::kZAxis,
		//	AcGePoint3d::kOrigin,AcGeVector3d::kXAxis,AcGeVector3d::kYAxis,AcGeVector3d(point.x,point.y,point.z));
		
		//得到垂直向量
		AcGeVector3d line3dVector(x,y,z);
		AcGeVector3d rotateVctor = line3dVector.crossProduct(AcGeVector3d::kZAxis);

		//得到角度
		double angle = line3dVector.angleTo(AcGeVector3d::kZAxis)/-2;

		//double angle = _wtof(m_A10.GetBuffer());
		acutPrintf(L"向量角度,除以-2,进行旋转[%lf]\n",angle);

		//AcGeMatrix3d rotateMatrix = AcGeMatrix3d::rotation( (3.14159265358979323846 * angle ) / 360,AcGeVector3d(point.x,point.y,point.z),AcGePoint3d::kOrigin);
		AcGeMatrix3d rotateMatrix = AcGeMatrix3d::rotation( angle, rotateVctor, AcGePoint3d::kOrigin);
		m3dSolid->transformBy(rotateMatrix);

		//X轴旋转
		//AcGeVector3d vecX(_wtof(m_A20.GetBuffer()),_wtof(m_A21.GetBuffer()),_wtof(m_A22.GetBuffer()));

		//得到

		//rotateMatrix = AcGeMatrix3d::rotation( ( 3.14159265358979323846 * _wtof(m_A10.GetBuffer()) ) / 180 , vecX );
		m3dSolid->transformBy(rotateMatrix);

		//Y轴旋转
		//AcGeVector3d vecY(0,1,0);
		//rotateMatrix = AcGeMatrix3d::rotation( ( 3.14159265358979323846 * _wtof(m_A11.GetBuffer()) ) / 180, vecY );
		//m3dSolid->transformBy(rotateMatrix);

		//Z轴旋转
		//AcGeVector3d vecZ(0,0,1);
		//rotateMatrix = AcGeMatrix3d::rotation( ( 3.14159265358979323846 * _wtof(m_A12.GetBuffer()) ) / 180, vecZ );
		//m3dSolid->transformBy(rotateMatrix);
	}

	//然后进行相应的位移
	{
		AcGeVector3d moveVec(_wtof(m_T0.GetBuffer()), _wtof(m_T1.GetBuffer()), _wtof(m_T2.GetBuffer()));

		AcGeMatrix3d moveMatrix;
		moveMatrix.setToTranslation(moveVec);

		m3dSolid->transformBy(moveMatrix);
	}

	// 将圆锥体添加到模型空间
	PostToModelSpace(m3dSolid);
	*/

	/*
	//AcGePoint3d orignal(_wtof(m_T0.GetBuffer()), _wtof(m_T1.GetBuffer()), _wtof(m_T2.GetBuffer()));
		
	int offset = 0;
	
	if( m_strOffset.GetLength())
		offset = _wtoi(m_strOffset);

	//generateCutRegion(pSolid,offset,m_Direction);
	*/

	CAcUiDialog::OnOK();
}