本文整理汇总了C++中XYZ类的典型用法代码示例。如果您正苦于以下问题:C++ XYZ类的具体用法?C++ XYZ怎么用?C++ XYZ使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了XYZ类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: set
char BindTriangle::set(const XY* corner, const XY& at, const XYZ* positions, const XYZ& topos, const float* distance, triangle_bind_info& res)
{
//res.wei[0] = 1.0f;
//res.wei[1] = res.wei[2] = 0.0f;
XYZ dto = topos - positions[0];
if(dto.length() > distance[0]*2) return 0;
dto = topos - positions[1];
if(dto.length() > distance[1]*2) return 0;
dto = topos - positions[2];
if(dto.length() > distance[2]*2) return 0;
float f120 = barycentric_coord(corner[1].x, corner[1].y, corner[2].x, corner[2].y, corner[0].x, corner[0].y);
float f201 = barycentric_coord(corner[2].x, corner[2].y, corner[0].x, corner[0].y, corner[1].x, corner[1].y);
float f012 = barycentric_coord(corner[0].x, corner[0].y, corner[1].x, corner[1].y, corner[2].x, corner[2].y);
float alpha, beta, gamma;
alpha = barycentric_coord(corner[1].x,corner[1].y, corner[2].x, corner[2].y, at.x, at.y)/f120;
if(alpha<0 || alpha>1) return 0;
beta = barycentric_coord(corner[2].x, corner[2].y, corner[0].x, corner[0].y, at.x, at.y)/f201;
if(beta<0 || beta>1) return 0;
gamma = barycentric_coord(corner[0].x, corner[0].y, corner[1].x, corner[1].y, at.x, at.y)/f012;
if(gamma<0 || gamma>1) return 0;
res.wei[0] = alpha;
res.wei[1] = beta;
res.wei[2] = gamma;
return 1;
}
开发者ID:saggita,项目名称:makoto,代码行数:33,代码来源:BindTriangle.cpp
示例2: XYZ
void TrialMol::SetBasis(const uint p1, const uint p2)
{
using namespace geom;
//W is unit vec of p1->p2
XYZ wVec = axes->MinImage(tCoords.Difference(p2, p1), box);
wVec.Normalize();
XYZ uVec;
//check to make sure our W isn't in line with the standard X Axis
if (wVec.x < 0.8) {
//V will be W x the standard X unit vec
uVec = XYZ(1.0, 0.0, 0.0);
}
else {
//V will be W x the standard Y unit vec
uVec = XYZ(0.0, 1.0, 0.0);
}
XYZ vVec = Cross(wVec, uVec);
vVec.Normalize();
//U is unit vec perpendicular to both V and W
uVec = Cross(vVec, wVec);
growthToWorld.BasisRotation(uVec, vVec, wVec);
worldToGrowth = growthToWorld.Inverse();
basisPoint = tCoords.Get(p1);
}
开发者ID:YounesN,项目名称:GOMCHilbert,代码行数:25,代码来源:TrialMol.cpp
示例3: Recon_Back_WS_One
int Confo_Back::Recon_Back_WS_One(XYZ *mol,char *cle,int moln,XYZ **output,XYZ pre,XYZ nxt)
{
if(moln!=1)return -1;
XYZ real;
double dist;
//pre
real=pre-mol[0];
dist=pre.distance(mol[0]);
real=real/dist;
real=real*3.8;
case_mol[0]=mol[0]+real;
//nxt
real=nxt-mol[0];
dist=nxt.distance(mol[0]);
real=real/dist;
real=real*3.8;
case_mol[2]=mol[0]+real;
//construct
case_mol[1]=mol[0];
case_cle[0]='Q';
if(cle[0]!='R')case_cle[1]=cle[0];
else case_cle[1]='Q';
case_cle[2]='Q';
//build
int retv;
retv=Recon_Back_WS(case_mol,case_cle,3,case_mcb);
if(retv!=1)return retv;
//final
int j;
for(j=0;j<5;j++)output[0][j]=case_mcb[1][j];
//return
return 1;
}
开发者ID:realbigws,项目名称:DeepOpen_source,代码行数:33,代码来源:Confo_Back.cpp
示例4: Construct_Mol_II
void Confo_Back::Construct_Mol_II(XYZ pre,XYZ cur,XYZ nxt,double bend,double tort,double dist,XYZ &out)
{
XYZ xyz;
double x[3],y[3];
double z[3];
double cb1[3],cb2[3];
xyz=nxt-cur;
xyz.xyz2double(x);
xyz=cur-pre;
xyz.xyz2double(y);
//check
double angle=Vector_Angle(x,y,3);
if(fabs(angle)<1.e-3||fabs(angle-M_PI)<1.e-3)
{
x[0]+=0.05;
x[2]-=0.05;
y[0]-=0.05;
y[2]+=0.05;
}
//calc
cross(z,x,y);
Universal_Rotation(z,bend,Confo_Back_ROT_TOT);
Vector_Multiply(cb1,Confo_Back_ROT_TOT,x);
Universal_Rotation(x,tort,Confo_Back_ROT_TOT);
Vector_Multiply(cb2,Confo_Back_ROT_TOT,cb1);
Vector_Normalize(cb2,3);
Vector_Dot(cb2,dist,cb2,3);
out.double2xyz(cb2);
out+=nxt;
}
开发者ID:realbigws,项目名称:DeepOpen_source,代码行数:30,代码来源:Confo_Back.cpp
示例5: slotDataAvailable
void SensorfwGyroscope::slotDataAvailable(const XYZ& data)
{
m_reading.setX((qreal)(data.x()*MILLI));
m_reading.setY((qreal)(data.y()*MILLI));
m_reading.setZ((qreal)(data.z()*MILLI));
m_reading.setTimestamp(data.XYZData().timestamp_);
newReadingAvailable();
}
开发者ID:mortenelund,项目名称:qt,代码行数:8,代码来源:sensorfwgyroscope.cpp
示例6: slotDataAvailable
void meegorotationsensor::slotDataAvailable(const XYZ& data)
{
m_reading.setX(data.x());
m_reading.setY(data.y());
m_reading.setZ(data.z());
m_reading.setTimestamp(data.XYZData().timestamp_);
newReadingAvailable();
}
开发者ID:KDE,项目名称:android-qt-mobility,代码行数:8,代码来源:meegorotationsensor.cpp
示例7: main
int main(){
XYZ X;
ABC A;
X.setValue(20);
A.setValue(12);
add(X,A);
return 0;
}
开发者ID:prateek27,项目名称:Coding-Problems,代码行数:9,代码来源:FriendToAddData.cpp
示例8: IMP_INTERNAL_CHECK
void Transform::apply_index(Model *m, ParticleIndex pi) const {
if (!XYZ::get_is_setup(m, pi)) {
IMP_INTERNAL_CHECK(ignore_non_xyz_,
"The particle does not have XYZ attributes");
return;
}
XYZ xyz = XYZ(m, pi);
xyz.set_coordinates(t_.get_transformed(xyz.get_coordinates()));
}
开发者ID:j-ma-bu-l-l-ock,项目名称:imp,代码行数:9,代码来源:Transform.cpp
示例9: OldThetaAndPhi
void TrialMol::OldThetaAndPhi(const uint atom, const uint lastAtom,
double& theta, double& phi) const
{
XYZ diff = tCoords.Difference(atom, lastAtom);
diff = axes->MinImage(diff, box);
XYZ growthCoords = worldToGrowth.Apply(diff);
theta = acos(growthCoords.z / growthCoords.Length());
phi = atan2(growthCoords.y, growthCoords.x);
return;
}
开发者ID:YounesN,项目名称:GOMCHilbert,代码行数:10,代码来源:TrialMol.cpp
示例10: IMP_INTERNAL_CHECK
void Transform::apply(Particle *p) const
{
if (!XYZ::particle_is_instance(p)) {
IMP_INTERNAL_CHECK(ignore_non_xyz_,
"The particle does not have XYZ attributes");
return;
}
XYZ xyz = XYZ(p);
xyz.set_coordinates(t_.get_transformed(xyz.get_coordinates()));
}
开发者ID:drussel,项目名称:imp,代码行数:10,代码来源:Transform.cpp
示例11: if
void FDice::create(const XYZ& p0, const XYZ& p1, const XYZ& p2)
{
p_obj[0] = P[0] = p0;
p_obj[1] = P[1] = p1;
p_obj[2] = P[2] = p2;
V[0] = p1 - p0;
edge_length[0] = V[0].length();
V[1] = p2 - p1;
edge_length[1] = V[1].length();
V[2] = p0 - p2;
edge_length[2] = V[2].length();
area = 0.5*sqrt(edge_length[0]*edge_length[0]*edge_length[2]*edge_length[2] - (V[0].dot(V[2]))*(V[0].dot(V[2])));
V[0].normalize();
V[1].normalize();
V[2].normalize();
int a , b;
if(edge_length[0] > edge_length[1] && edge_length[0] > edge_length[2])
{
a = 0;
b = 1;
}
else if(edge_length[1] > edge_length[2] && edge_length[1] > edge_length[0])
{
a = 1;
b = 2;
}
else
{
a = 2;
b = 0;
}
XYZ side = V[a];
XYZ front = side^V[b]; front.normalize();
XYZ up = front^side;
m_space.setOrientations(side, up, front);
m_space.setTranslation(P[a]);
m_space.inverse();
m_space.transform(p_obj[0]);
m_space.transform(p_obj[1]);
m_space.transform(p_obj[2]);
f120 = barycentric_coord(p_obj[1].x, p_obj[1].y, p_obj[2].x, p_obj[2].y, p_obj[0].x, p_obj[0].y);
f201 = barycentric_coord(p_obj[2].x, p_obj[2].y, p_obj[0].x, p_obj[0].y, p_obj[1].x, p_obj[1].y);
f012 = barycentric_coord(p_obj[0].x, p_obj[0].y, p_obj[1].x, p_obj[1].y, p_obj[2].x, p_obj[2].y);
}
开发者ID:esotericDisciple,项目名称:makoto,代码行数:55,代码来源:FDice.cpp
示例12:
int Confo_Back::Recon_Back_WS_2nxt(XYZ *mol,char *cle,int moln,XYZ **output,XYZ nxt)
{
if(moln!=2)return -1;
XYZ real;
double dist;
real=nxt-mol[1];
dist=nxt.distance(mol[1]);
real=real/dist;
real=real*3.8;
real=mol[1]+real;
//construct
case_mol[0]=mol[0];
case_mol[1]=mol[1];
case_mol[2]=real;
if(cle[0]!='R')case_cle[0]=cle[0];
else case_cle[0]='Q';
if(cle[1]!='R')case_cle[1]=cle[1];
else case_cle[1]='Q';
case_cle[2]='Q';
//build
int retv;
retv=Recon_Back_WS(case_mol,case_cle,3,case_mcb);
if(retv!=1)return retv;
//final
int i,j;
for(i=0;i<2;i++)for(j=0;j<5;j++)output[i][j]=case_mcb[i][j];
//return
return 1;
}
开发者ID:realbigws,项目名称:DeepOpen_source,代码行数:29,代码来源:Confo_Back.cpp
示例13: isCloseTo
char sphericalHarmonics::isCloseTo(const XYZ& ray, const float threshold, unsigned int id) const
{
SHSample& s = getSample(id);
float c = ray.dot(s.vector);
float t = sqrt(1-c*c)/c;
if(t >threshold) return 0;
return 1;
}
开发者ID:saggita,项目名称:makoto,代码行数:8,代码来源:zSphericalHarmonics.cpp
示例14: Confo_Beta_CACB_To_Angle
//--------------function------------//
//given CA+CB -> return dist,bend,tort
void Confo_Beta::Confo_Beta_CACB_To_Angle(XYZ *CA,XYZ *CB,int moln,double *bend,double *tort,double *dist)
{
int i;
double r,b,t;
XYZ xyz;
//process
for(i=1;i<moln-1;i++)
{
//get_point
xyz=(CA[i]-CA[i-1]);
xyz.xyz2double(beta_v1);
xyz=(CA[i+1]-CA[i]);
xyz.xyz2double(beta_v2);
xyz=(CB[i]-CA[i]);
xyz.xyz2double(beta_y);
//calc
r=dot(beta_y,beta_y);
if(r<1.e-3)
{
r=0.0;
b=0.0;
t=0.0;
}
else
{
//calc_bend
b=Vector_Angle(beta_v1,beta_y,3);
//calc_tort
cross(beta_x1,beta_v1,beta_v2);
cross(beta_x2,beta_v1,beta_y);
t=Vector_Angle(beta_x1,beta_x2,3);
if(dot(beta_x1,beta_y)<0.0)t*=-1.0;
}
//evaluate
if(dist!=NULL)dist[i]=r;
if(bend!=NULL)bend[i]=b;
if(tort!=NULL)tort[i]=t;
}
//assign head_tail
if(dist!=NULL)dist[0]=-1.0;
if(bend!=NULL)bend[0]=0.0;
if(tort!=NULL)tort[0]=0.0;
if(dist!=NULL)dist[moln-1]=-1.0;
if(bend!=NULL)bend[moln-1]=0.0;
if(tort!=NULL)tort[moln-1]=0.0;
}
开发者ID:realbigws,项目名称:DeepAlign,代码行数:48,代码来源:Confo_Beta.cpp
示例15: Cross
void TrialMol::SetBasis(const uint p1, const uint p2, const uint p3)
{
using namespace geom;
//W is unit vec of p1->p2
XYZ wVec = axes->MinImage(tCoords.Difference(p2, p1), box);
wVec.Normalize();
//U will be unit projection of p2->p3 onto plane normal to W
XYZ uVec = axes->MinImage(tCoords.Difference(p3, p2), box);
//V is unit vec perpendicular to both W and U
XYZ vVec = Cross(wVec, uVec);
vVec.Normalize();
//Finish X'
uVec = Cross(vVec, wVec);
growthToWorld.BasisRotation(uVec, vVec, wVec);
worldToGrowth = growthToWorld.Inverse();
basisPoint = tCoords.Get(p1);
}
开发者ID:YounesN,项目名称:GOMCHilbert,代码行数:18,代码来源:TrialMol.cpp
示例16: Confo_Beta_Angle_To_CACB
//given CA and dist,bend,tort -> return CB (Zheng & Liu's method)
void Confo_Beta::Confo_Beta_Angle_To_CACB(XYZ *CA,XYZ *CB,int moln,double *bend,double *tort,double *dist)
{
int i,j;
XYZ xyz;
double beta,radii;
//process
for(i=1;i<moln-1;i++)
{
//init
if(dist==NULL)beta=Confo_Beta_Levit_Radii;
else beta=dist[i];
if(beta<0.0)
{
CB[i]=CA[i];
continue;
}
//calc
xyz=(CA[i]-CA[i-1]);
xyz.xyz2double(beta_v1);
xyz=(CA[i+1]-CA[i]);
xyz.xyz2double(beta_v2);
cross(beta_y,beta_v1,beta_v2);
Universal_Rotation(beta_y,bend[i],Confo_Beta_rotmat);
Vector_Multiply(beta_x1,Confo_Beta_rotmat,beta_v1);
Universal_Rotation(beta_v1,tort[i],Confo_Beta_rotmat);
Vector_Multiply(beta_x2,Confo_Beta_rotmat,beta_x1);
//evaluate
radii=sqrt(dot(beta_x2,beta_x2));
CA[i].xyz2double(beta_ca);
for(j=0;j<3;j++)beta_cb[j]=beta_ca[j]+beta*beta_x2[j]/radii;
CB[i].double2xyz(beta_cb);
}
//assign head_tail //this might be modified in the future...
if(moln>1)
{
CB[0]=CB[1]-CA[1]+CA[0];
CB[moln-1]=CB[moln-2]-CA[moln-2]+CA[moln-1];
}
else
{
CB[0]=CA[0];
CB[moln-1]=CA[moln-1];
}
}
开发者ID:realbigws,项目名称:DeepAlign,代码行数:45,代码来源:Confo_Beta.cpp
示例17: Confo_Beta_Levit_To_CACB
//given CA -> return CB (Levitt's method)
void Confo_Beta::Confo_Beta_Levit_To_CACB(XYZ *CA,XYZ *CB,int moln,double *dist)
{
int i,j;
XYZ xyz;
double beta,theta;
//process
theta=Confo_Beta_Levit_Angle;
for(i=1;i<moln-1;i++) //omit head and tail
{
//init
if(dist==NULL)beta=Confo_Beta_Levit_Radii;
else beta=dist[i];
if(beta<0.0)
{
CB[i]=CA[i];
continue;
}
//calc
xyz=(CA[i]-CA[i-1]);
xyz.xyz2double(beta_v1);
xyz=(CA[i]-CA[i+1]);
xyz.xyz2double(beta_v2);
Vector_Addition(beta_x1,beta_v1,beta_v2,3);
Vector_Normalize(beta_x1,3);
cross(beta_x2,beta_v1,beta_v2);
Vector_Normalize(beta_x2,3);
//evaluate
CA[i].xyz2double(beta_ca);
for(j=0;j<3;j++)beta_cb[j]=beta_ca[j]+beta*(cos(theta)*beta_x1[j]+sin(theta)*beta_x2[j]);
CB[i].double2xyz(beta_cb);
}
//assign head_tail //this might be modified in the future...
if(moln>1)
{
CB[0]=CB[1]-CA[1]+CA[0];
CB[moln-1]=CB[moln-2]-CA[moln-2]+CA[moln-1];
}
else
{
CB[0]=CA[0];
CB[moln-1]=CA[moln-1];
}
}
开发者ID:realbigws,项目名称:DeepAlign,代码行数:45,代码来源:Confo_Beta.cpp
示例18: tick
void TriangleMeshViewer::tick()
{
const int t=clock->elapsed();
const float dt=0.001f*(t-last_t);
last_t=t;
camera_roll_rate=0.0f;
if (keypressed_arrow_left || keypressed_mouse_left) camera_roll_rate+=0.5f;
if (keypressed_arrow_right || keypressed_mouse_right) camera_roll_rate-=0.5f;
if (keypressed_arrow_up) camera_velocity+=120.0f*(0.03125f/480.0f);
if (keypressed_arrow_down) camera_velocity-=120.0f*(0.03125f/480.0f);
//! \todo Replace cheesy rotation hacks with proper rotation matrices
XYZ camera_right=(camera_forward*camera_up).normalised();
const XYZ camera_right_rolled=camera_right+(dt*camera_roll_rate)*camera_up;
const XYZ camera_up_rolled=camera_up-(dt*camera_roll_rate)*camera_right;
camera_right=camera_right_rolled.normalised();
camera_up=camera_up_rolled.normalised();
camera_forward=(camera_forward+dt*camera_yaw_rate*camera_right+dt*camera_pitch_rate*camera_up).normalised();
camera_up=(camera_right*camera_forward).normalised();
camera_position+=(dt*camera_velocity)*camera_forward;
object_rotation+=object_spinrate*dt;
if (display->isVisible())
{
display->draw_frame(camera_position,camera_position+camera_forward,camera_up,object_rotation,object_tilt);
}
std::ostringstream msg;
if (fly_mode)
{
msg << "Velocity:" << camera_velocity << " Roll rate:" << camera_roll_rate << " ";
}
msg << notify_message;
statusbar->showMessage(msg.str().c_str());
}
开发者ID:ldo,项目名称:fracplanet,代码行数:42,代码来源:triangle_mesh_viewer.cpp
示例19: Construct_CB
void Confo_Back::Construct_CB(XYZ N,XYZ Ca,XYZ C,double bend,double tort,double dist,XYZ &Cb)
{
XYZ xyz;
double x[3],y[3];
double z[3];
double cb1[3],cb2[3];
xyz=C-Ca;
xyz.xyz2double(x);
xyz=Ca-N;
xyz.xyz2double(y);
cross(z,x,y);
Universal_Rotation(z,-1.0*bend,Confo_Back_ROT_TOT);
Vector_Multiply(cb1,Confo_Back_ROT_TOT,x);
Universal_Rotation(x,-1.0*tort,Confo_Back_ROT_TOT);
Vector_Multiply(cb2,Confo_Back_ROT_TOT,cb1);
Vector_Normalize(cb2,3);
Vector_Dot(cb2,dist,cb2,3);
Cb.double2xyz(cb2);
Cb+=Ca;
}
开发者ID:realbigws,项目名称:DeepOpen_source,代码行数:20,代码来源:Confo_Back.cpp
示例20: tri
void Console::doCompute(){
// Matrix3 CAM = chromaticAdaptationMatrix(SRC_RW, DST_RW, METHOD);
// XYZ.from(SRC, SRC_RW);
// XYZ = CAM * XYZ
// SRC.from(XYZ, DST_RW);
// SRC
int srwIndex = _srwIndex + _srcObsIndex;
int drwIndex = _drwIndex + _dstObsIndex;
const Illuminant* srw = nullptr;
const Illuminant* drw = nullptr;
XYZ xyz;
Vector3 tri;
tri(0) = get<1>(_input)->text().toFloat();
tri(1) = get<2>(_input)->text().toFloat();
tri(2) = get<3>(_input)->text().toFloat();
if(_fromIndex >= 0 and _fromIndex <= 5)
srw = _rw[srwIndex];
else
_cs[_fromIndex]->referenceWhite(srw);
if(_toIndex >= 0 and _toIndex <= 5)
drw = _rw[drwIndex];
else
_cs[_toIndex]->referenceWhite(drw);
_cs[_fromIndex]->coords() = tri;
xyz.coords() = _cs[_fromIndex]->to_XYZ(srw);
Matrix3 cam = chromaticAdaptationMatrix(*srw, *drw, _am[_camIndex]);
xyz.coords() = cam * xyz.coords();
_cs[_toIndex]->from_XYZ(xyz.coords(), drw);
tri = _cs[_toIndex]->coords();
get<1>(_output)->setText(QString::number( tri(0), 'f', 10));
get<2>(_output)->setText(QString::number( tri(1), 'f', 10));
get<3>(_output)->setText(QString::number( tri(2), 'f', 10));
}
开发者ID:Arlen,项目名称:Kolourmatica,代码行数:41,代码来源:Console.cpp
注:本文中的XYZ类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论