本文整理汇总了C++中SVector3::Set方法的典型用法代码示例。如果您正苦于以下问题:C++ SVector3::Set方法的具体用法?C++ SVector3::Set怎么用?C++ SVector3::Set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SVector3
的用法示例。
在下文中一共展示了SVector3::Set方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReadFundamentalZoneFile
//------------------------------
//
// ReadFundamentalZoneFile
//
//------------------------------
bool ReadFundamentalZoneFile( vector<SVector3> & vFZEulerAngleList,
const string & sFilename )
{
char *pBuffer = NULL;
Size_Type nBufSize = 0;
vector< vector<string> > vsTokens;
pBuffer = ReadFileToBuf(nBufSize, sFilename);
if(pBuffer == NULL){
return false;
}
string sBuffStr( pBuffer, nBufSize );
GeneralLib::Tokenize( vsTokens, sBuffStr, ",# \t\n");
for(Size_Type i = 0; i < vsTokens.size(); i ++){
RUNTIME_ASSERT( (vsTokens[i].size() >= 3),
"[ReadFundamentalZoneFile] ERROR: Invalid Euler Angles\n");
Float fPhi = DEGREE_TO_RADIAN( atof( vsTokens[i][0].c_str() ) );
Float fTheta = DEGREE_TO_RADIAN( atof( vsTokens[i][1].c_str() ) );
Float fPsi = DEGREE_TO_RADIAN( atof( vsTokens[i][2].c_str() ) );
SVector3 newAngles;
newAngles.Set( fPhi, fTheta, fPsi );
vFZEulerAngleList.push_back( newAngles );
}
delete [] pBuffer;
return true;
}
示例2: ReadEffient
//---------------------------------------------------------
//
// Public:
// Read
//
//
//---------------------------------------------------------
// MIC file format
//
// line 1: a0, the fundamental lattice constant for the triangular mesh
//
// others:
//
// columns 1 -3: xyz location of left vertex of a triangle
// column 4: 1/2 for triangle type -- 1 for upward pointing or 2 for downward
// pointing
// column 5: generation number -- triangle side length = a0/(2^generation),
// generation = 0,1,2,...
// column 6: 0/1 for phase -- 0 mean it wasn't (or hasn't yet) fitted to an
// orientation, 1 means it was
// columns 7 -9: Eulers in degrees
// column 10: confidence parameter: fraction of simulated Bragg peaks that hit
// experimental peaks
//---------------------------------------------------------
bool CMic::ReadEffient( const string &filename )
{
vector< vector<string> > vsTokens;
if( !ReadFileToBuf(filename))
{
return false;
}
std::ifstream InputStream;
if( !InputStream.open( filename ) )
return false;
std::string Tokens = " \t\n";
// GeneralLib::Tokenize( vsTokens, string( pBuffer, nBufferSize ), " \t\n");
// we expect side length for the first line
if(vsTokens[0].size() > 1){
cerr << "[CMic::ReadMicFile] Incorrect Mic File Format " << filename << endl;
exit(0);
}
// fInitialSideLength = atof(vsTokens[0][0].c_str());
// for( Size_Type i = 1; i < vsTokens.size(); i ++){
while()
{
if(vsTokens[i].size() < 9 )
{
cerr << "[CMic::ReadMicFile] Error: Incorrect number of columns, line: "
<< i << filename << endl;
}
else
{
DEBUG_ALERT( vsTokens[i].size() >= 10, "CMic::Read: Warning! Old format MIC file with only 9 columns\n" );
SVoxel v;
v.nGeneration = atoi( vsTokens[i][4].c_str() );
v.fSideLength = fInitialSideLength / pow( 2, v.nGeneration ) ;
v.nPhase = atoi( vsTokens[i][5].c_str() );
Float fX, fY, fZ;
fX = atof( vsTokens[i][0].c_str() );
fY = atof( vsTokens[i][1].c_str() );
fZ = atof( vsTokens[i][2].c_str() );
if ( atoi( vsTokens[i][3].c_str() ) == UP )
{
// Winding order, counter clockwise
v.pVertex[0].Set( fX, fY, fZ );
v.pVertex[1].Set( fX + v.fSideLength, fY, fZ );
v.pVertex[2].Set( fX + v.fSideLength / (Float) 2.0 , fY + v.fSideLength / (Float) 2.0 * sqrt( (Float) 3.0 ) , fZ);
v.bVoxelPointsUp = true;
}
else
{
// Winding order, counter clockwise
v.pVertex[0].Set( fX, fY, fZ );
v.pVertex[1].Set( fX + v.fSideLength / (Float) 2.0 , fY - v.fSideLength / (Float) 2.0 * sqrt( (Float) 3.0 ) , fZ);
v.pVertex[2].Set( fX + v.fSideLength, fY, fZ );
v.bVoxelPointsUp = false;
}
SVector3 oOrientation;
oOrientation.Set( DEGREE_TO_RADIAN( atof(vsTokens[i][6].c_str()) ),
DEGREE_TO_RADIAN( atof(vsTokens[i][7].c_str()) ),
DEGREE_TO_RADIAN( atof(vsTokens[i][8].c_str()) ) );
// note that orientation matrix assigned here - the choice of active vs. passive
// transform is made by the file format
v.oOrientMatrix.BuildActiveEulerMatrix( oOrientation.m_fX,
oOrientation.m_fY,
//.........这里部分代码省略.........