本文整理汇总了C++中side函数的典型用法代码示例。如果您正苦于以下问题:C++ side函数的具体用法?C++ side怎么用?C++ side使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了side函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getSpeed
Ogre::Quaternion DetectedVehicle::getOrientation() const
{
Ogre::Vector3 speed = getSpeed() ;
Ogre::Vector3 side(-speed.y,speed.x,-speed.z) ;
side.normalise() ;
Ogre::Vector3 forward = speed ;
forward.normalise() ;
Ogre::Vector3 up = forward.crossProduct(side) ;
up.normalise() ;
return Ogre::Quaternion(side,up,forward) ;
}
示例2: dot2D
float Vector3::angle2D(const Vector3 &v)
{
float dp, angPI ;
dp = dot2D(v); //dot product
if(dp >= 1.0) dp = 1.0f;
if(dp <=-1.0) dp =-1.0f;
angPI = (float)acos(dp);
//determina a posicao relativa do vetor
return angPI * side(v);
}
示例3: figureAt
bool BoardController::moveFigure(int from, int to)
{
if(!m_logic_controller.isMoveAllowed(from, to) || from == to)
return false;
auto victim = figureAt(to);
auto victim_type = victim->type();
auto victim_color = victim->side();
Transition t(from, to, victim_color, victim_type);
_moveFigure(from, to);
emit figureMoved(t);
return true;
}
示例4: side
void UmlRelation::write_ends(FileOut & out) {
// note : it is the first side
out.indent();
out << "\t<memberEnd";
out.idref(this);
out << "/>\n";
UmlRelation * other = side(FALSE);
out.indent();
if (other != 0) {
out << "\t<memberEnd";
out.idref(other);
out << "/>\n";
}
else {
out << "\t<ownedEnd xmi:type=\"uml:Property\"";
out.id_prefix(this, "REVERSE_");
if (_assoc_class != 0)
out.ref(_assoc_class, "association");
else
out.ref(this, "association", "ASSOC_");
out << " visibility=\"" << ((_vis_prefix) ? "vis_private\"" : "private\"");
out.ref(parent(), "type");
out << " aggregation=\"";
if (_gen_eclipse)
out << "none";
else {
switch (relationKind()) {
case anAggregation:
case aDirectionalAggregation:
out << "shared";
break;
case anAggregationByValue:
case aDirectionalAggregationByValue:
out << "composite";
break;
default:
out << "none";
}
}
out << "\" isNavigable=\"false\"/>\n";
out.indent();
out << "\t<memberEnd ";
out.idref_prefix(this, "REVERSE_");
out << "/>\n";
}
}
示例5: main
/* main loop */
int
main(void)
{
input_line = (char *)malloc(6 * sizeof(char));
led_setperm();
set_time = 200000;
while (strncmp(input_line, "quit", 4) != 0)
{
input_line = readline("Led Control> ");
/* I know instruction parsing is really lame :/ */
if (!strncmp(input_line, "help", 4))
help();
if (!strncmp(input_line, "ledon", 5))
ledon();
if (!strncmp(input_line, "ledoff", 6))
ledoff();
if (!strncmp(input_line, "settime", 7))
settime();
if (!strncmp(input_line, "volume", 6))
volume();
if (!strncmp(input_line, "bin", 3))
bin();
if (!strncmp(input_line, "slide", 5))
slide();
if (!strncmp(input_line, "blink", 5))
blink();
if (!strncmp(input_line, "bislide", 7))
bislide();
if (!strncmp(input_line, "biblink", 7))
biblink();
if (!strncmp(input_line, "grow", 4))
grow();
if (!strncmp(input_line, "center", 6))
center();
if (!strncmp(input_line, "side", 4))
side();
if (!strncmp(input_line, "biside", 6))
biside();
if (!strncmp(input_line, "demo", 4))
demo();
}
led_off_all();
exit(0);
}
示例6: side
//-----------------------------------------------------------------------------
// xxx perhaps this should be a call to a general purpose annotation for
// xxx "local xxx axis aligned box in XZ plane" -- same code in in
// xxx CaptureTheFlag.cpp
void Pedestrian::annotateAvoidObstacle( const float minDistanceToCollision )
{
const osVector3 boxSide = side() * radius();
const osVector3 boxFront = forward() * minDistanceToCollision;
const osVector3 FR = position() + boxFront - boxSide;
const osVector3 FL = position() + boxFront + boxSide;
const osVector3 BR = position() - boxSide;
const osVector3 BL = position() + boxSide;
const Color white( 1,1,1 );
annotationLine( FR, FL, white );
annotationLine( FL, BL, white );
annotationLine( BL, BR, white );
annotationLine( BR, FR, white );
}
示例7: tag
Material::Material(Material_t tag)
: tag(tag),
vertexShader(this),
fragmentShader(this),
index0AttributeName(this)
{
mId = Material::MaterialIdCount++;
mUuid = Math::generateUUID();
mName = "";
side() = kFrontSide;
opacity() = 1.0f;
transparent() = false;
blending() = kNormalBlending;
blendSrc() = kSrcAlphaFactor;
blendDst() = kOneMinusSrcAlphaFactor;
blendEquation() = kAddEquation;
depthTest() = true;
depthWrite() = true;
polygonOffset() = false;
polygonOffsetFactor() = 0;
polygonOffsetUnits() = 0;
// mAlphaTest = 0;
overdraw() = 0; // Overdrawn pixels (typically between 0 and 1) for fixing antialiasing gaps in CanvasRenderer
visible() = true;
needsUpdate() = true;
// By default, bind position to attribute index 0. In WebGL, attribute 0
// should always be used to avoid potentially expensive emulation.
index0AttributeName("position");
linewidth() = 1.0f;
metal() = false;
perPixel() = true;
shading() = kNoShading;
vertexColors() = kNoColors;
wireframe() = false;
wireframeLinewidth() = 1.0f;
}
示例8: check
inline static bool check(long long int &sx, long long int &sy)
{
printf("P: %lld %lld\n", sx, sy);
unsigned int f = 0, size = verts - 2, mid;
while(size > 2)
{
mid = (f + size / 2) % verts;
if(side(std::make_pair(0, 0), fence[f], std::make_pair(sx, sy)) <= 0 &&
side(std::make_pair(0, 0), fence[(f + size) % verts], std::make_pair(sx, sy)) >= 0)
{
f = (f + size) % verts;
size = verts - size;
continue;
}
if(side(std::make_pair(0, 0), fence[mid], std::make_pair(sx, sy)) < 0)
f = mid;
size /= 2;
}
printf(">>%u %u\n", f, (f + size) % verts);
return side(fence[f], fence[(f + size) % verts], std::make_pair(sx, sy)) >= 0;
}
示例9: tab
void Simplex::pivot(int row, int col) {
float pivot = tab(row, col);
if(pivot == 0)
exit(-1);
for(int i(0); i < tab.cols(); ++i)
tab(row, i) /= pivot;
for (int i = 0; i < tab.rows(); ++i) {
float multip = tab(i, col);
if(i == row) continue;
for (int j = 0; j < tab.cols(); ++j) {
tab(i, j) -= multip * tab(row, j);
}
}
side(row-1) = col;
}
示例10: turn
Controller::Controller()
{
turnProportionalGain = 1.0f; //converts offset from camera to turn duty cycle
throttleProportionalGain = 10.0f; // converts offset in the y direction to throttle
sideProportionalGain = 1.0f;
hover_throttle = 1.54;
lower_altitude = 0;
//initialize all controls to neutral
turn(1.5);
forward(1.48);
side(1.59);
throttle(1.09);
isStarted = 0;
time_lift = 0;
}
示例11: findIntersectionWithVehiclePath
void
OpenSteer::
BoxObstacle::
findIntersectionWithVehiclePath (const AbstractVehicle& vehicle,
PathIntersection& pi) const
{
// abbreviations
const float w = width; // dimensions
const float h = height;
const float d = depth;
const Vec3 s = side (); // local space
const Vec3 u = up ();
const Vec3 f = forward ();
const Vec3 p = position ();
const Vec3 hw = s * (0.5f * width); // offsets for face centers
const Vec3 hh = u * (0.5f * height);
const Vec3 hd = f * (0.5f * depth);
const seenFromState sf = seenFrom ();
// the box's six rectangular faces
RectangleObstacle r1 (w, h, s, u, f, p + hd, sf); // front
RectangleObstacle r2 (w, h, -s, u, -f, p - hd, sf); // back
RectangleObstacle r3 (d, h, -f, u, s, p + hw, sf); // side
RectangleObstacle r4 (d, h, f, u, -s, p - hw, sf); // other side
RectangleObstacle r5 (w, d, s, -f, u, p + hh, sf); // top
RectangleObstacle r6 (w, d, -s, -f, -u, p - hh, sf); // bottom
// group the six RectangleObstacle faces together
ObstacleGroup faces;
faces.push_back (&r1);
faces.push_back (&r2);
faces.push_back (&r3);
faces.push_back (&r4);
faces.push_back (&r5);
faces.push_back (&r6);
// find first intersection of vehicle path with group of six faces
PathIntersection next;
firstPathIntersectionWithObstacleGroup (vehicle, faces, pi, next);
// when intersection found, adjust PathIntersection for the box case
if (pi.intersect)
{
pi.obstacle = this;
pi.steerHint = ((pi.surfacePoint - position ()).normalize () *
(pi.vehicleOutside ? 1.0f : -1.0f));
}
}
示例12: testCreateNewOrderSingle
int testCreateNewOrderSingle( int count )
{
int start = GetTickCount();
for ( int i = 0; i <= count; ++i )
{
FIX::ClOrdID clOrdID( "ORDERID" );
FIX::HandlInst handlInst( '1' );
FIX::Symbol symbol( "LNUX" );
FIX::Side side( FIX::Side_BUY );
FIX::TransactTime transactTime;
FIX::OrdType ordType( FIX::OrdType_MARKET );
FIX42::NewOrderSingle( clOrdID, handlInst, symbol, side, transactTime, ordType );
}
return GetTickCount() - start;
}
示例13: InsertionSort
int InsertionSort(int base[], int sz ){
int i,j;
int temp;
int count = 0;
for(i=1;i<sz;++i){
temp = base[i];
for(j = i-1; j>=0 && temp < base[j] ; --j ){
base[j+1] = base[j];
move to right side(+1) element one by one
++count;
}
base[j+1] = temp;
}
printf("total count of loop : %d \n", count);
return 0;
}
示例14: side
void ChessGame::startTurn()
{
if (m_paused)
return;
Chess::Side side(m_board->sideToMove());
Q_ASSERT(!side.isNull());
emit humanEnabled(m_player[side]->isHuman());
Chess::Move move(bookMove(side));
if (move.isNull())
m_player[side]->go();
else
m_player[side]->makeBookMove(move);
}
示例15: ray
bool polygon::contains(vec2d vertex) const
{
// check to see if we have points
if(this->vertexes.size() > 0)
{
// see if we are more than a point
if(this->vertexes.size() > 1)
{
// see if we are more than an edge
if(this->vertexes.size() > 2)
{
int windCount = 0;
edge ray(vertex, vertex + vec2d(1, 0));
for(unsigned int i = 0; i < this->vertexes.size(); i++)
{
edge side(this->vertexes[i], this->vertexes[(i + 1) % this->vertexes.size()]);
if(side.contains(vertex))
return true;
if(side.offset().y != 0)
{
auto intersect = ray.intersect(side);
if(side.contains(intersect) && intersect.x >= ray.origin().x)
{
windCount += (int)(side.offset().y / abs(side.offset().y));
}
}
}
return windCount != 0;
} else
{
// we're an edge so compare along edginess
edge thisEdge(this->vertexes[0], this->vertexes[1]);
return thisEdge.contains(vertex);
}
} else
{
// we're a vertex so compare as vertices
return vertex == this->vertexes[0];
}
} else
{
return false;
}
}