本文整理汇总了C++中P2函数的典型用法代码示例。如果您正苦于以下问题:C++ P2函数的具体用法?C++ P2怎么用?C++ P2使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了P2函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main() {
__CPROVER_ASYNC_0: P0(0);
__CPROVER_ASYNC_1: P1(0);
__CPROVER_ASYNC_2: P2(0);
__CPROVER_assume(__unbuffered_cnt==3);
fence();
// EXPECT:exists
__CPROVER_assert(!(__unbuffered_p1_r1==1 && __unbuffered_p2_r1==1 && __unbuffered_p2_r3==0), "Program was expected to be safe for PPC, model checker should have said NO.\nThis likely is a bug in the tool chain.");
return 0;
}
示例2: main
int main() {
Bitmap bitmap(640, 480);
Camera cam; cam.zoom = 1, cam.focus = 10000, cam.height = 100;
BezObj teapot(INPUT);
teapot.move(P3(0, -100, -1000));
teapot.rotateZ(-45);
teapot.rotateX(-45);
teapot.split(2);
cam.shot(teapot, bitmap);
ImageProcessor ip(&bitmap);
ip.rerange(
P2(-320, -240),
P2(0, 0)
);
ip.GaussianBlur(2);
bitmap.save(OUTPUT);
system(OUTPUT);
return 0;
}
示例3: main
int main() {
__CPROVER_ASYNC_0: P0(0);
__CPROVER_ASYNC_1: P1(0);
__CPROVER_ASYNC_2: P2(0);
__CPROVER_assume(__unbuffered_cnt==3);
fence();
// EXPECT:exists
__CPROVER_assert(!(z==2 && __unbuffered_p1_r1==1 && __unbuffered_p2_r1==1), "Program proven to be relaxed for PPC, model checker says YES.");
return 0;
}
示例4: myType
AREXPORT ArMapObject::ArMapObject(const char *type,
ArPose pose,
const char *description,
const char *iconName,
const char *name,
bool hasFromTo,
ArPose fromPose,
ArPose toPose) :
myType((type != NULL) ? type : ""),
myBaseType(),
myName((name != NULL) ? name : "" ),
myDescription((description != NULL) ? description : "" ),
myPose(pose),
myIconName((iconName != NULL) ? iconName : "" ),
myHasFromTo(hasFromTo),
myFromPose(fromPose),
myToPose(toPose),
myFromToSegments(),
myStringRepresentation()
{
if (myHasFromTo)
{
double angle = myPose.getTh();
double sa = ArMath::sin(angle);
double ca = ArMath::cos(angle);
double fx = fromPose.getX();
double fy = fromPose.getY();
double tx = toPose.getX();
double ty = toPose.getY();
ArPose P0((fx*ca - fy*sa), (fx*sa + fy*ca));
ArPose P1((tx*ca - fy*sa), (tx*sa + fy*ca));
ArPose P2((tx*ca - ty*sa), (tx*sa + ty*ca));
ArPose P3((fx*ca - ty*sa), (fx*sa + ty*ca));
myFromToSegments.push_back(ArLineSegment(P0, P1));
myFromToSegments.push_back(ArLineSegment(P1, P2));
myFromToSegments.push_back(ArLineSegment(P2, P3));
myFromToSegments.push_back(ArLineSegment(P3, P0));
myFromToSegment.newEndPoints(fromPose, toPose);
}
else { // pose
size_t whPos = myType.rfind("WithHeading");
size_t whLen = 11;
if (whPos > 0) {
if (whPos == myType.size() - whLen) {
myBaseType = myType.substr(0, whPos);
}
}
} // end else pose
IFDEBUG(
ArLog::log(ArLog::Normal,
"ArMapObject::ctor() created %s (%s)",
myName.c_str(), myType.c_str());
);
示例5: FillRectangle
void FillRectangle( const DrawUtils::DrawInfos& i, Pixel& P )
{
float Alpha = i.Coverage;
float Distance = 1.0f - 2.0f * abs(i.Distance);
Pixel P2( NjFloat4( Distance, 0, 0, 0 ) ); // Draw distance to border in red
if ( Distance < 0.0f )
Alpha = 0.0f;
P.Blend( P2, Alpha );
}
示例6: t_pair_PH
double t_pair_PH(double E, Particle& particle, Fun* tpf) //E=Ep
{
DataInjection data;
data.E = E;
data.mass = particle.mass;
data.tpf = tpf;
double mass = particle.mass;
double cte = 0.5*P2(mass*cLight2)*cLight;
double b = 10*targetPhotonEmax; //energia maxima de los fotones en erg
double a1 = mass*P2(cLight)*pairThresholdPH/(2*E);
double a = std::max(a1,targetPhotonEmin);
double integral = RungeKutta(a,b,&cPairPH,&dPH,&f_t_PHPair,&data);
return cte*integral/P2(E);
}
示例7: main
int main() {
__CPROVER_ASYNC_0: P0(0);
__CPROVER_ASYNC_1: P1(0);
__CPROVER_ASYNC_2: P2(0);
__CPROVER_ASYNC_3: P3(0);
__CPROVER_assume(__unbuffered_cnt==4);
fence();
// EXPECT:exists
__CPROVER_assert(!(x==2 && z==2 && __unbuffered_p1_EAX==0 && __unbuffered_p3_EAX==2 && __unbuffered_p3_EBX==0), "Program proven to be relaxed for X86, model checker says YES.");
return 0;
}
示例8: P1
inline void AbstractPath::filterOffset(const int i, Vec2f& here) const {
Vec2f P1(getElement(i-1), getElement(i));
Vec2f P2(getElement(i+1), getElement(i));
float p1len = P1.Len(), p2len = P2.Len(), sum = p1len+p2len;
P1 *= p2len / sum;
P2 *= p1len / sum;
here = P1;
here += P2;
}
示例9: P2
maxint_t P2(maxint_t x, int threads)
{
if (x < 1)
return 0;
double alpha = get_alpha_deleglise_rivat(x);
string limit = get_max_x(alpha);
if (x > to_maxint(limit))
throw primecount_error("P2(x): x must be <= " + limit);
if (is_print())
set_print_variables(true);
int64_t y = (int64_t) (iroot<3>(x) * alpha);
if (x <= numeric_limits<int64_t>::max())
return P2((int64_t) x, y, threads);
else
return P2(x, y, threads);
}
示例10: _getEdges
std::vector<sf::Vector2f> _getEdges(TPPLPoly& A)
{
std::vector<sf::Vector2f> edges;
for(unsigned int i=0; i < (A.GetNumPoints()+1) ; ++i)
{
sf::Vector2f P1( A[i].x, A[i].y);
sf::Vector2f P2( A[(i+1)%A.GetNumPoints()].x, A[(i+1)%A.GetNumPoints()].y );
edges.push_back( P2 - P1 );
}
return edges;
}
示例11: ptcloudFromCorrespondences
Eigen::MatrixXd ptcloudFromCorrespondences(const std::string& correspondencesFilename, const std::string& extrinsicsFilename, const std::string& ptcloudFilename)
{
// THE UNDISTORTED POINTS (calibrated by K in P1, P2)
std::ifstream in1(correspondencesFilename);
if (in1.bad())
return Eigen::MatrixXd(1,3);
unsigned int N = 0;
char buf[256];
for (; in1.good(); N++)
in1.getline(buf, 256);
N--; // Advanced past for loop
in1.close();
std::ifstream in(correspondencesFilename);
if (in.bad())
return Eigen::MatrixXd(1, 3);
char c;
std::vector< cv::Point2d > x1v, x2v;
for (unsigned int i = 0; i < N && !in.bad(); i++)
{
double x1x, x1y, x2x, x2y, max, qwx, qwy;
in >> x1x >> c >> x1y >> c >> x2x >> c >> x2y >> c >> max >> c >> qwx >> c >> qwy;
// Hardcoded threshold of .6, qw > .5
if ((max > .6))// && (qwx > .5) && (qwy > .5)) // if stabilization
{
x1v.push_back(cv::Point2d(x1x, x1y));
x2v.push_back(cv::Point2d(x2x, x2y));
}
}
Eigen::MatrixXd x1(2, x1v.size());
Eigen::MatrixXd x2(2, x2v.size());
unsigned int co = 0;
for (std::vector<cv::Point2d>::iterator x1r = x1v.begin(), x2r = x2v.begin(); ((x1r != x1v.end()) && (x2r != x2v.end())); x1r++, x2r++, co++)
{
x1(0, co) = x1r->x;
x1(1, co) = x1r->y;
x2(0, co) = x2r->x;
x2(1, co) = x2r->y;
}
Eigen::MatrixXd P1 = Eigen::MatrixXd::Identity(3, 4), P2 = Eigen::MatrixXd::Identity(3, 4);
P2(0, 3) = 1.0;
if (extrinsicsFilename != "")
{
std::ifstream extrinsicsFile(extrinsicsFilename);
if (extrinsicsFile.bad())
return Eigen::MatrixXd(1, 3);
double rx, ry, rz, tx, ty, tz;
extrinsicsFile >> rx >> c >> ry >> c >> rz >> c;
extrinsicsFile >> tx >> c >> ty >> c >> tz >> c;
std::cout << "Getting extrinsics: " << rx << ',' << ry << ',' << rz << ',' << tx << ',' << ty << ',' << tz << std::endl;
P2 = cameraMatrixKnownRT(rx, ry, rz, tx, ty, tz);
}
示例12: bitmapHeaderInit
bool Bitmap::setSize(int width, int height) {
if(buffer)
delete [] buffer;
this->width = width;
this->height = height;
if(width * height > 2073600)
return false;
bitmapHeaderInit(header, width, height);
buffer = new RGB[width * height];
setOrigin(P2(width / 2 - 1, height / 2 - 1));
return true;
}
示例13: test_Bbox_E3_operator_incr
void test_Bbox_E3_operator_incr()
{
Point_E3d P1(-5,-4,-3);
Point_E3d P2( 7, 6, 5);
Bbox_E3d box(P1);
box += P2;
assert( box == Bbox_E3d(P1, P2) );
assert( box.center() == Point_E3d(1,1,1) );
}
示例14: P1
bool CSPrimBox::Write2XML(TiXmlElement &elem, bool parameterised)
{
CSPrimitives::Write2XML(elem,parameterised);
TiXmlElement P1("P1");
m_Coords[0].Write2XML(&P1,parameterised);
elem.InsertEndChild(P1);
TiXmlElement P2("P2");
m_Coords[1].Write2XML(&P2,parameterised);
elem.InsertEndChild(P2);
return true;
}
示例15: main
int main() {
GlobalPoint P1(3., 4., 7.);
GlobalPoint P2(-2., 5., 7.);
oldCode(P1,P2);
newCode(P1,P2);
oldCode(P2,P1);
newCode(P2,P1);
return 0;
}