本文整理汇总了C++中point1函数的典型用法代码示例。如果您正苦于以下问题:C++ point1函数的具体用法?C++ point1怎么用?C++ point1使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了point1函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: dgAssert
dgInt32 dgCollisionInstance::CalculatePlaneIntersection (const dgVector& normal, const dgVector& point, dgVector* const contactsOut) const
{
dgInt32 count = 0;
dgAssert(normal.m_w == dgFloat32 (0.0f));
switch (m_scaleType)
{
case m_unit:
{
count = m_childShape->CalculatePlaneIntersection (normal, point, contactsOut);
break;
}
case m_uniform:
{
dgVector point1 (m_invScale * point);
count = m_childShape->CalculatePlaneIntersection (normal, point1, contactsOut);
for (dgInt32 i = 0; i < count; i ++) {
contactsOut[i] = m_scale * contactsOut[i];
}
break;
}
case m_nonUniform:
{
// support((p * S), n) = S * support (p, n * transp(S))
dgVector point1 (m_invScale * point);
dgVector normal1 (m_scale * normal);
normal1 = normal1.Normalize();
count = m_childShape->CalculatePlaneIntersection (normal1, point1, contactsOut);
for (dgInt32 i = 0; i < count; i ++) {
contactsOut[i] = m_scale * contactsOut[i];
}
break;
}
case m_global:
default:
{
dgVector point1 (m_aligmentMatrix.UntransformVector (m_invScale * point));
dgVector normal1 (m_aligmentMatrix.UntransformVector (m_scale * normal));
normal1 = normal1.Normalize();
count = m_childShape->CalculatePlaneIntersection (normal1, point1, contactsOut);
for (dgInt32 i = 0; i < count; i ++) {
contactsOut[i] = m_scale * m_aligmentMatrix.TransformVector(contactsOut[i]);
}
}
}
return count;
}
开发者ID:AntonSynytsia,项目名称:MSPhysics,代码行数:48,代码来源:dgCollisionInstance.cpp
示例2: Arrow2D
void Arrow2D(const Point<float>& tail, const Point<float>& head)
{
// u-v-w - Arrow coordinate system:
Vector<float> u, v, w;
Vector<float> arrowLine(tail, head);
GetOrthonormalBasisFromNormal(arrowLine, u, v, w);
// set size of wings and turn w into a Unit vector:
float d = WINGS * arrowLine.norm();
// draw the shaft of the arrow:
glBegin(GL_LINE_STRIP);
glVertex3f(tail.x(), tail.y(), tail.z());
glVertex3f(head.x(), head.y(), head.z());
glEnd();
Vector<float> point1(head.x() + d * (u.x() - w.x()), head.y() + d * (u.y() - w.y()), head.z() + d * (u.z() - w.z()));
glBegin(GL_LINE_STRIP);
glVertex3f(head.x(), head.y(), head.z());
glVertex3f(point1.x(), point1.y(), point1.z());
glEnd();
Vector<float> point2(head.x() + d * (-u.x() - w.x()), head.y() + d * (-u.y() - w.y()), head.z() + d * (-u.z() - w.z()));
glBegin(GL_LINE_STRIP);
glVertex3f(head.x(), head.y(), head.z());
glVertex3f(point2.x(), point2.y(), point2.z());
glEnd();
}
开发者ID:indivisibleatom,项目名称:averaging,代码行数:28,代码来源:geometryHelpers.cpp
示例3: point1
/**
* This method parses a Python tuple and builds a CylinderVectorGenerator.
* The arguments accepted are two triples of numbers and two numbers. Args
* is not a borrowed object so it needs to have its reference count
* decremented after use.
*
* @param args Python tuple containing initialisation information.
*
* @return A pointer to the newly created vector generator if successful;
* NULL, otherwise.
*/
CylinderVectorGenerator *CylinderVectorGenerator::parsePythonTuple(
PyObject *args )
{
BW_GUARD;
float x1, y1, z1;
float x2, y2, z2;
float maxRadius, minRadius;
if ( PyArg_ParseTuple( args, "(fff)(fff)ff",
&x1, &y1, &z1,
&x2, &y2, &z2,
&maxRadius, &minRadius ) )
{
Vector3 point1( x1, y1, z1 );
Vector3 point2( x2, y2, z2 );
Py_DECREF( args );
return new CylinderVectorGenerator( point1, point2, maxRadius,
minRadius );
}
else
{
PyErr_SetString( PyExc_TypeError, "CylinderVectorGenerator:"
"Expected (x1,y1,z1), (x2,y2,z2), maxRadius, minRadius." );
Py_DECREF( args );
return NULL;
}
}
开发者ID:siredblood,项目名称:tree-bumpkin-project,代码行数:39,代码来源:vector_generator.cpp
示例4: Release
void MyPrimitive::GenerateTorus(float a_fOuterRadius, float a_fInnerRadius, int a_nSubdivisionsA, int a_nSubdivisionsB, vector3 a_v3Color)
{
if (a_fOuterRadius <= a_fInnerRadius + 0.1f)
return;
if (a_nSubdivisionsA < 3)
a_nSubdivisionsA = 3;
if (a_nSubdivisionsA > 25)
a_nSubdivisionsA = 25;
if (a_nSubdivisionsB < 3)
a_nSubdivisionsB = 3;
if (a_nSubdivisionsB > 25)
a_nSubdivisionsB = 25;
Release();
Init();
//Your code starts here
float fValue = 0.5f;
//3--2
//| |
//0--1
vector3 point0(-fValue, -fValue, fValue); //0
vector3 point1(fValue, -fValue, fValue); //1
vector3 point2(fValue, fValue, fValue); //2
vector3 point3(-fValue, fValue, fValue); //3
AddQuad(point0, point1, point3, point2);
//Your code ends here
CompileObject(a_v3Color);
}
开发者ID:alexwharper,项目名称:ReEngineApp_2015s,代码行数:33,代码来源:MyPrimitive.cpp
示例5: point1
bool SVGPathParser::parseCurveToQuadraticSmoothSegment()
{
FloatPoint targetPoint;
if (!m_source.parseCurveToQuadraticSmoothSegment(targetPoint))
return false;
if (m_lastCommand != PathSegCurveToQuadraticAbs
&& m_lastCommand != PathSegCurveToQuadraticRel
&& m_lastCommand != PathSegCurveToQuadraticSmoothAbs
&& m_lastCommand != PathSegCurveToQuadraticSmoothRel)
m_controlPoint = m_currentPoint;
if (m_pathParsingMode == NormalizedParsing) {
FloatPoint cubicPoint = m_currentPoint;
cubicPoint.scale(2);
cubicPoint.move(-m_controlPoint.x(), -m_controlPoint.y());
FloatPoint point1(m_currentPoint.x() + 2 * cubicPoint.x(), m_currentPoint.y() + 2 * cubicPoint.y());
FloatPoint point2(targetPoint.x() + 2 * cubicPoint.x(), targetPoint.y() + 2 * cubicPoint.y());
if (m_mode == RelativeCoordinates) {
point2 += m_currentPoint;
targetPoint += m_currentPoint;
}
point1.scale(gOneOverThree);
point2.scale(gOneOverThree);
m_consumer.curveToCubic(point1, point2, targetPoint, AbsoluteCoordinates);
m_controlPoint = cubicPoint;
m_currentPoint = targetPoint;
} else
m_consumer.curveToQuadraticSmooth(targetPoint, m_mode);
return true;
}
开发者ID:eocanha,项目名称:webkit,代码行数:33,代码来源:SVGPathParser.cpp
示例6: center
void ShadowScene::drawMagicCircle(){
int interval = 360/64; //ここの値を変えてみよう
int max_num = 360 / interval;
for (int angle = 0; angle < 360; angle+=interval) {
if (angle > 360) angle = 360;
int cur_num = angle / interval;
float radius = 0.0f;
Vector3<float> center(0.0f,0.0f,0.0f);
Vector2<double> texcoc(0.5,0.5);
radius = DEGREE_TO_RADIAN(angle);
Vector3<float> point1(cos(radius),0.0f,sin(radius));
Vector2<double> texco1((cos(radius) + 1)/2,(sin(radius) + 1)/2);
radius = DEGREE_TO_RADIAN(angle + interval);
Vector3<float> point2(cos(radius),0.0f,sin(radius));
Vector2<double> texco2((cos(radius) + 1)/2,(sin(radius) + 1)/2);
Vector3<float> normal(0.0f,1.0f,0.0f);
//座標変換等の開始
glPushMatrix();
glBegin(GL_TRIANGLES); //描画の開始
glNormal3fv(normal.v); //法線の定義
glTexCoord2d(texcoc.x, texcoc.y); glVertex3fv(center.v); //頂点3個目
glTexCoord2d(texco1.x, texco1.y); glVertex3fv(point1.v); //頂点2個目
glTexCoord2d(texco2.x, texco2.y); glVertex3fv(point2.v); //頂点1個目
//描画の終了
glEnd();
//座標変換の終了
glPopMatrix();
}
}
开发者ID:kudolf,项目名称:Game,代码行数:32,代码来源:ShadowScene.cpp
示例7: Release
void MyPrimitive::GenerateTube(float a_fOuterRadius, float a_fInnerRadius, float a_fHeight, int a_nSubdivisions, vector3 a_v3Color)
{
if (a_nSubdivisions < 3)
a_nSubdivisions = 3;
if (a_nSubdivisions > 360)
a_nSubdivisions = 360;
Release();
Init();
for (int i = 0; i < a_nSubdivisions; i++)
{
float ang = (2 * PI) / a_nSubdivisions;
vector3 point0(a_fOuterRadius*cos((i + 1)*ang), a_fHeight, a_fOuterRadius*sin((i + 1)*ang)); //1
vector3 point1(a_fOuterRadius*cos(i*ang), 0, a_fOuterRadius*sin(i*ang)); //2
vector3 point2(a_fOuterRadius*cos(i*ang), a_fHeight, a_fOuterRadius*sin(i*ang)); //0
vector3 point3(a_fOuterRadius*cos((i + 1)*ang), 0, a_fOuterRadius*sin((i + 1)*ang)); //3
vector3 point4(a_fInnerRadius*cos((i + 1)*ang), a_fHeight, a_fInnerRadius*sin((i + 1)*ang)); //1
vector3 point5(a_fInnerRadius*cos(i*ang), 0, a_fInnerRadius*sin(i*ang)); //2
vector3 point6(a_fInnerRadius*cos(i*ang), a_fHeight, a_fInnerRadius*sin(i*ang)); //0
vector3 point7(a_fInnerRadius*cos((i + 1)*ang), 0, a_fInnerRadius*sin((i + 1)*ang)); //3
AddQuad(point4, point0, point6, point2); //Top
AddQuad(point0, point3, point2, point1); //Outer
AddQuad(point7, point5, point3, point1); //Bottom
AddQuad(point5, point7, point6,point4 ); // Inner
}
//Your code ends here
CompileObject(a_v3Color);
}
开发者ID:sml5527,项目名称:ReEngineApp_2015s,代码行数:34,代码来源:MyPrimitive.cpp
示例8: makeChamber
BaseIF* makeChamber(const Real& radius,
const Real& thick,
const Real& offset,
const Real& height)
{
RealVect zero(D_DECL(0.0,0.0,0.0));
RealVect xAxis(D_DECL(1.0,0.0,0.0));
bool inside = true;
Vector<BaseIF*> pieces;
// Create a chamber
TiltedCylinderIF chamberOut(radius + thick/2.0,xAxis,zero, inside);
TiltedCylinderIF chamberIn (radius - thick/2.0,xAxis,zero,!inside);
IntersectionIF infiniteChamber(chamberIn,chamberOut);
pieces.push_back(&infiniteChamber);
RealVect normal1(D_DECL(1.0,0.0,0.0));
RealVect point1(D_DECL(offset,0.0,0.0));
PlaneIF plane1(normal1,point1,inside);
pieces.push_back(&plane1);
RealVect normal2(D_DECL(-1.0,0.0,0.0));
RealVect point2(D_DECL(offset+height,0.0,0.0));
PlaneIF plane2(normal2,point2,inside);
pieces.push_back(&plane2);
IntersectionIF* chamber = new IntersectionIF(pieces);
return chamber;
}
开发者ID:rsnemmen,项目名称:Chombo,代码行数:35,代码来源:pointCoarseningTest.cpp
示例9: point1
void NormalQuantifier::build (UInt32 numberSubdivisions)
{
UInt32 index = 0;
UInt32 nN = ((1 << (2 * numberSubdivisions)) * 8);
_numberSubdivisions = numberSubdivisions;
_normalTable.resize(nN);
if(_numberSubdivisions != 0)
{
for(UInt32 octant = 0; octant < 8; octant++)
{
Int32 xoctant = (octant & 4)>0?-1:1;
Int32 yoctant = (octant & 2)>0?-1:1;
Int32 zoctant = (octant & 1)>0?-1:1;
Vec3f point1(0.f * xoctant, 0.f * yoctant, 1.f * zoctant);
Vec3f point2(1.f * xoctant, 0.f * yoctant, 0.f * zoctant);
Vec3f point3(0.f * xoctant, 1.f * yoctant, 0.f * zoctant);
subdivide(point1, point2, point3, _numberSubdivisions+1, index);
}
if(index != nN)
{
FFATAL(("NormalQuantifier::build() index missmatch!\n"));
}
else
{
FLOG(("NormalQuantifier init: %d subdivision, %d normal\n",
_numberSubdivisions, _normalTable.size()));
}
}
}
开发者ID:mlimper,项目名称:OpenSG1x,代码行数:35,代码来源:OSGNormalQuantifier.cpp
示例10: makeVane
BaseIF* makeVane(const Real& thick,
const RealVect& normal,
const Real& innerRadius,
const Real& outerRadius,
const Real& offset,
const Real& height)
{
RealVect zero(D_DECL(0.0,0.0,0.0));
RealVect xAxis(D_DECL(1.0,0.0,0.0));
bool inside = true;
Vector<BaseIF*> vaneParts;
// Each side of the vane (infinite)
RealVect normal1(normal);
RealVect point1(D_DECL(offset+height/2.0,-thick/2.0,0.0));
PlaneIF plane1(normal1,point1,inside);
vaneParts.push_back(&plane1);
RealVect normal2(-normal);
RealVect point2(D_DECL(offset+height/2.0,thick/2.0,0.0));
PlaneIF plane2(normal2,point2,inside);
vaneParts.push_back(&plane2);
// Make sure we only get something to the right of the origin
RealVect normal3(D_DECL(0.0,0.0,1.0));
RealVect point3(D_DECL(0.0,0.0,0.0));
PlaneIF plane3(normal3,point3,inside);
vaneParts.push_back(&plane3);
// Cut off the top and bottom
RealVect normal4(D_DECL(1.0,0.0,0.0));
RealVect point4(D_DECL(offset,0.0,0.0));
PlaneIF plane4(normal4,point4,inside);
vaneParts.push_back(&plane4);
RealVect normal5(D_DECL(-1.0,0.0,0.0));
RealVect point5(D_DECL(offset+height,0.0,0.0));
PlaneIF plane5(normal5,point5,inside);
vaneParts.push_back(&plane5);
// The outside of the inner cylinder
TiltedCylinderIF inner(innerRadius,xAxis,zero,!inside);
vaneParts.push_back(&inner);
// The inside of the outer cylinder
TiltedCylinderIF outer(outerRadius,xAxis,zero,inside);
vaneParts.push_back(&outer);
IntersectionIF* vane = new IntersectionIF(vaneParts);
return vane;
}
开发者ID:rsnemmen,项目名称:Chombo,代码行数:60,代码来源:swirl.cpp
示例11: main
int main()
{
// Take the counts per second (frequency) at the start of the program
/*float dt = 0;
__int64 cntsPerSec = 0;
QueryPerformanceFrequency((LARGE_INTEGER*)&cntsPerSec);
float secsPerCnt = 1.0f / (float)cntsPerSec;
__int64 prevTimeStamp = 0;
QueryPerformanceCounter((LARGE_INTEGER*)&prevTimeStamp);
__int64 currTimeStamp = 0;
do
{
QueryPerformanceCounter((LARGE_INTEGER*)&currTimeStamp);
dt = (currTimeStamp - prevTimeStamp) * secsPerCnt;
std::cout << "Time: " << dt << std::endl;
}while(dt <= 10);*/
/*Clock myClock = Clock();
do
{
myClock.SetDeltaTime();
std::cout << "Time: " << myClock.GetDeltaTime() << std::endl;
}while(myClock.GetDeltaTime() <= 10);*/
Point2D point1(3.0, 0.0);
Point2D point2(1.5, 0.0);
bool bCheck= CollisionCheck2D_AABB(point1, point2) ;
std::cout << "The distance between Point1: (" << point1.x << "," << point1.y << ") and Point2: (" << point2.x << "," << point2.y << ")" << std::endl;
std::cout << "Dist: " << distance2D(point1.x, point1.y, point2.x, point2.y) << std::endl;
std::cout << "Collision check: " << bCheck << std::endl;
return 0;
}
开发者ID:ChrisC64,项目名称:TestWork,代码行数:35,代码来源:Main.cpp
示例12: getAlpha
void Rectangle3DOverlay::render(RenderArgs* args) {
if (!_visible) {
return; // do nothing if we're not visible
}
float alpha = getAlpha();
xColor color = getColor();
const float MAX_COLOR = 255.0f;
glm::vec4 rectangleColor(color.red / MAX_COLOR, color.green / MAX_COLOR, color.blue / MAX_COLOR, alpha);
glm::vec3 position = getPosition();
glm::vec2 dimensions = getDimensions();
glm::vec2 halfDimensions = dimensions * 0.5f;
glm::quat rotation = getRotation();
auto batch = args->_batch;
if (batch) {
Transform transform;
transform.setTranslation(position);
transform.setRotation(rotation);
batch->setModelTransform(transform);
auto geometryCache = DependencyManager::get<GeometryCache>();
if (getIsSolid()) {
glm::vec3 topLeft(-halfDimensions.x, -halfDimensions.y, 0.0f);
glm::vec3 bottomRight(halfDimensions.x, halfDimensions.y, 0.0f);
geometryCache->bindSimpleProgram(*batch);
geometryCache->renderQuad(*batch, topLeft, bottomRight, rectangleColor);
} else {
geometryCache->bindSimpleProgram(*batch, false, false, false, true, true);
if (getIsDashedLine()) {
glm::vec3 point1(-halfDimensions.x, -halfDimensions.y, 0.0f);
glm::vec3 point2(halfDimensions.x, -halfDimensions.y, 0.0f);
glm::vec3 point3(halfDimensions.x, halfDimensions.y, 0.0f);
glm::vec3 point4(-halfDimensions.x, halfDimensions.y, 0.0f);
geometryCache->renderDashedLine(*batch, point1, point2, rectangleColor);
geometryCache->renderDashedLine(*batch, point2, point3, rectangleColor);
geometryCache->renderDashedLine(*batch, point3, point4, rectangleColor);
geometryCache->renderDashedLine(*batch, point4, point1, rectangleColor);
} else {
if (halfDimensions != _previousHalfDimensions) {
QVector<glm::vec3> border;
border << glm::vec3(-halfDimensions.x, -halfDimensions.y, 0.0f);
border << glm::vec3(halfDimensions.x, -halfDimensions.y, 0.0f);
border << glm::vec3(halfDimensions.x, halfDimensions.y, 0.0f);
border << glm::vec3(-halfDimensions.x, halfDimensions.y, 0.0f);
border << glm::vec3(-halfDimensions.x, -halfDimensions.y, 0.0f);
geometryCache->updateVertices(_geometryCacheID, border, rectangleColor);
_previousHalfDimensions = halfDimensions;
}
geometryCache->renderVertices(*batch, gpu::LINE_STRIP, _geometryCacheID);
}
}
}
}
开发者ID:AlexanderOtavka,项目名称:hifi,代码行数:59,代码来源:Rectangle3DOverlay.cpp
示例13: box
void AxisAlignedBoxTest::collisionPoint() {
Shapes::AxisAlignedBox3D box({-1.0f, -2.0f, -3.0f}, {1.0f, 2.0f, 3.0f});
Shapes::Point3D point1({-1.5f, -1.0f, 2.0f});
Shapes::Point3D point2({0.5f, 1.0f, -2.5f});
VERIFY_NOT_COLLIDES(box, point1);
VERIFY_COLLIDES(box, point2);
}
开发者ID:ArEnSc,项目名称:magnum,代码行数:8,代码来源:AxisAlignedBoxTest.cpp
示例14: contain
bool RTRBoundingBox::contain(const RTRVector3D& point) const
{
for (int i = 0; i < 3; i++)
{
if (point(i) < point1(i) || point(i) > point2(i)) return false;
}
return true;
}
开发者ID:tansinan,项目名称:course_project_ray_trace_renderer,代码行数:8,代码来源:RTRGeometry.cpp
示例15: optimize
// out: optimized model-shape
// in: GRAY img
// in: evtl zusaetzlicher param um scale-level/iter auszuwaehlen
// calculates shape updates (deltaShape) for one or more iter/scales and returns...
// assume we get a col-vec.
cv::Mat optimize(cv::Mat modelShape, cv::Mat image) {
for (int cascadeStep = 0; cascadeStep < model.getNumCascadeSteps(); ++cascadeStep) {
//feature_current = obtain_features(double(TestImg), New_Shape, 'HOG', hogScale);
vector<cv::Point2f> points;
for (int i = 0; i < model.getNumLandmarks(); ++i) { // in case of HOG, need integers?
points.emplace_back(cv::Point2f(modelShape.at<float>(i), modelShape.at<float>(i + model.getNumLandmarks())));
}
Mat currentFeatures;
double dynamicFaceSizeDistance = 0.0;
if (true) { // adaptive
// dynamic face-size:
cv::Vec2f point1(modelShape.at<float>(8), modelShape.at<float>(8 + model.getNumLandmarks())); // reye_ic
cv::Vec2f point2(modelShape.at<float>(9), modelShape.at<float>(9 + model.getNumLandmarks())); // leye_ic
cv::Vec2f anchor1 = (point1 + point2) / 2.0f;
cv::Vec2f point3(modelShape.at<float>(11), modelShape.at<float>(11 + model.getNumLandmarks())); // rmouth_oc
cv::Vec2f point4(modelShape.at<float>(12), modelShape.at<float>(12 + model.getNumLandmarks())); // lmouth_oc
cv::Vec2f anchor2 = (point3 + point4) / 2.0f;
// dynamic window-size:
// From the paper: patch size $ S_p(d) $ of the d-th regressor is $ S_p(d) = S_f / ( K * (1 + e^(d-D)) ) $
// D = numCascades (e.g. D=5, d goes from 1 to 5 (Matlab convention))
// K = fixed value for shrinking
// S_f = the size of the face estimated from the previous updated shape s^(d-1).
// For S_f, can use the IED, EMD, or max(IED, EMD). We use the EMD.
dynamicFaceSizeDistance = cv::norm(anchor1 - anchor2);
double windowSize = dynamicFaceSizeDistance / 2.0; // shrink value
double windowSizeHalf = windowSize / 2.0;
windowSizeHalf = std::round(windowSizeHalf * (1 / (1 + exp((cascadeStep + 1) - model.getNumCascadeSteps())))); // this is (step - numStages), numStages is 5 and step goes from 1 to 5. Because our step goes from 0 to 4, we add 1.
int NUM_CELL = 3; // think about if this should go in the descriptorExtractor or not. Is it Hog specific?
int windowSizeHalfi = static_cast<int>(windowSizeHalf) + NUM_CELL - (static_cast<int>(windowSizeHalf) % NUM_CELL); // make sure it's divisible by 3. However, this is not needed and not a good way
currentFeatures = model.getDescriptorExtractor(cascadeStep)->getDescriptors(image, points, windowSizeHalfi);
}
else { // non-adaptive, the descriptorExtractor has all necessary params
currentFeatures = model.getDescriptorExtractor(cascadeStep)->getDescriptors(image, points);
}
currentFeatures = currentFeatures.reshape(0, currentFeatures.cols * model.getNumLandmarks()).t();
//delta_shape = AAM.RF(1).Regressor(hogScale).A(1:end - 1, : )' * feature_current + AAM.RF(1).Regressor(hogScale).A(end,:)';
Mat regressorData = model.getRegressorData(cascadeStep);
//Mat deltaShape = regressorData.rowRange(0, regressorData.rows - 1).t() * currentFeatures + regressorData.row(regressorData.rows - 1).t();
Mat deltaShape = currentFeatures * regressorData.rowRange(0, regressorData.rows - 1) + regressorData.row(regressorData.rows - 1);
if (true) { // adaptive
modelShape = modelShape + deltaShape.t() * dynamicFaceSizeDistance;
}
else {
modelShape = modelShape + deltaShape.t();
}
/*
for (int i = 0; i < m.getNumLandmarks(); ++i) {
cv::circle(landmarksImage, Point2f(modelShape.at<float>(i, 0), modelShape.at<float>(i + m.getNumLandmarks(), 0)), 6 - hogScale, Scalar(51.0f*(float)hogScale, 51.0f*(float)hogScale, 0.0f));
}*/
}
return modelShape;
};
开发者ID:PhilippKopp,项目名称:FeatureDetection,代码行数:63,代码来源:SdmLandmarkModel.hpp
示例16: int
void Checkbox::RenderCheck(Rect& rectArea)
{
Rect rectBox = rectArea;
int iBoxMargin = int(rectArea.Height() * 0.2);
int iBoxMarginRight = int(rectArea.Height() * 0.8 * 0.75);
rectBox.Left(rectBox.Left() + iBoxMargin);
rectBox.Right(rectBox.Left() + iBoxMarginRight);
rectBox.Top(rectBox.Top() + iBoxMargin);
rectBox.Bottom(rectBox.Bottom() - iBoxMargin);
OpenGL::PushedAttributes attr(GL_ENABLE_BIT | GL_LINE_BIT | GL_POINT_BIT);
glDisable(GL_TEXTURE_2D);
glEnable(GL_LINE_SMOOTH);
glEnable(GL_POINT_SMOOTH);
Color cBox = GetAttrAsColor(CheckboxAttr::BoxColor);
glColor4ubv(cBox.m_color);
glLineWidth(2.0);
glBegin(GL_LINE_LOOP);
glVertex2i(rectBox.Left(), rectBox.Bottom());
glVertex2i(rectBox.Right(), rectBox.Bottom());
glVertex2i(rectBox.Right(), rectBox.Top());
glVertex2i(rectBox.Left(), rectBox.Top());
glEnd();
if (IsChecked())
{
double iCheckUnit = rectBox.Height() * 0.1;
Point point1(int(rectBox.Left() + 3 * iCheckUnit), int(rectBox.Bottom() - 6 * iCheckUnit));
Point point2(int(rectBox.Left() + 6 * iCheckUnit), int(rectBox.Bottom() - 3 * iCheckUnit));
Point point3(int(rectBox.Left() + 11* iCheckUnit), int(rectBox.Bottom() - 11* iCheckUnit));
Color cCheck = GetAttrAsColor(CheckboxAttr::CheckColor);
glColor4ubv(cCheck.m_color);
glLineWidth(4.0);
glBegin(GL_LINES);
glVertex2i(point1.X(), point1.Y());
glVertex2i(point2.X(), point2.Y());
glVertex2i(point2.X(), point2.Y());
glVertex2i(point3.X(), point3.Y());
glEnd();
glPointSize(3.0);
glBegin(GL_POINTS);
glVertex2i(point1.X(), point1.Y());
glVertex2i(point2.X(), point2.Y());
glVertex2i(point3.X(), point3.Y());
glEnd();
}
// adjust rect for size of checkbox
int iOffset = int(rectArea.Height() * 1.1);
rectArea.Left(rectArea.Left() + iOffset);
}
开发者ID:vividos,项目名称:MultiplayerOnlineGame,代码行数:58,代码来源:Checkbox.cpp
示例17: testOperatorDouble
void testOperatorDouble()
{
FTPoint point1(1.0f, 2.0f, 3.0f);
const double* pointer = static_cast<const double*>(point1);
CPPUNIT_ASSERT(pointer[0] == 1.0f);
CPPUNIT_ASSERT(pointer[1] == 2.0f);
CPPUNIT_ASSERT(pointer[2] == 3.0f);
}
开发者ID:pjohalloran,项目名称:gameframework,代码行数:9,代码来源:FTPoint-Test.cpp
示例18: TestSameChastePoints
void TestSameChastePoints()
{
ChastePoint<3> point1(4,5,6);
ChastePoint<3> point2(4,5,6);
ChastePoint<3> point3(12,5,6);
TS_ASSERT(point1.IsSamePoint(point2));
TS_ASSERT(!point1.IsSamePoint(point3));
}
开发者ID:getshameer,项目名称:Chaste,代码行数:9,代码来源:TestChastePoint.hpp
示例19: INFO_PRINTF1
/**
@SYMTestCaseID GRAPHICS-WSERV-0021
@SYMDEF DEF081259
@SYMTestCaseDesc General PointerCursor Tests
@SYMTestPriority High
@SYMTestStatus Implemented
@SYMTestActions Exercise the different pointercursor methods of a Window Server Session
@SYMTestExpectedResults The methods are called without error
*/
void CTTSprite::GeneralPointerCursor()
{
if (!TestBase()->ConfigurationSupportsPointerEventTesting())
{
INFO_PRINTF1(_L("Test skipped because config does not support pointer event testing"));
return;
}
TInt currentSMode=TheClient->iScreen->CurrentScreenMode();
TInt altSMode=-1;
if (TheClient->iScreen->NumScreenModes()>1)
altSMode=(currentSMode==1?0:1);
RWsSession &ws=TheClient->iWs;
TRect rect=ws.PointerCursorArea();
TRect testRect1(TPoint(rect.iBr.iX/4,rect.iBr.iY/4),TSize(rect.Width()/2,rect.Height()/2));
TRect testRect2(TPoint(rect.iBr.iX/3,rect.iBr.iY/3),TSize(2*rect.Width()/3,2*rect.Height()/3));
ws.SetPointerCursorArea(testRect1);
TEST(ws.PointerCursorArea()==testRect1);
TEST(ws.PointerCursorArea(currentSMode)==testRect1);
ws.SetPointerCursorArea(currentSMode,testRect2);
TEST(ws.PointerCursorArea()==testRect2);
TEST(ws.PointerCursorArea(currentSMode)==testRect2);
ws.SetPointerCursorArea(rect);
TEST(ws.PointerCursorArea()==rect);
if (altSMode>=0)
{
rect=ws.PointerCursorArea(altSMode);
testRect1.iTl.iX=rect.iBr.iX/4;
testRect1.iTl.iY=rect.iBr.iY/4;
testRect1.SetWidth(rect.Width()/2);
testRect1.SetHeight(rect.Height()/2);
ws.SetPointerCursorArea(altSMode,testRect1);
TEST(ws.PointerCursorArea(altSMode)==testRect1);
ws.SetPointerCursorArea(altSMode,rect);
TEST(ws.PointerCursorArea(altSMode)==rect);
}
TPointerCursorMode currentMode=ws.PointerCursorMode();
TInt ii;
TInt err1;
for(ii=EPointerCursorFirstMode;ii<=EPointerCursorLastMode;ii++)
{
ws.SetPointerCursorMode(STATIC_CAST(TPointerCursorMode,ii));
err1 = ws.PointerCursorMode();
TEST(ii==err1);
if (ii!=err1)
INFO_PRINTF3(_L("ws.PointerCursorMode() return value - Expected: %d, Actual: %d"), ii, err1);
}
ws.SetPointerCursorMode(currentMode);
TEST(currentMode==ws.PointerCursorMode());
TPoint point1(10,12);
TPoint point2(24,20);
ws.PointerCursorPosition();
ws.SetPointerCursorPosition(point1);
TEST(ws.PointerCursorPosition()==point1);
ws.SetPointerCursorPosition(point2);
TEST(ws.PointerCursorPosition()==point2);
}
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:72,代码来源:TSPRITE.CPP
示例20: point1
void SegmentsTests<dimension>::run()
{
VecD origin1 = random_vec<VecD>();
VecD direction1 = random_vec<VecD>();
geom::Point<dimension> point1( new typename geom::Point<dimension>::EuclideanDriver( random_vec<HomogenousVecD>() ) );
geom::Point<dimension> point2( new typename geom::Point<dimension>::EuclideanDriver( random_vec<HomogenousVecD>() ) );
// Test based on line
geom::Line<dimension> line1( new typename geom::Line<dimension>::EuclideanDriver( origin1, direction1));
double firstIndex = random_float();
double lastIndex = random_float();
SegmentD seg1( new typename SegmentD::LineDriver( &line1, firstIndex, lastIndex ) );
test_segment_validity( seg1 );
GEOM_CHECK_VEC_EQUAL( seg1.firstPoint(), line1.pointAt(firstIndex) );
GEOM_CHECK_VEC_EQUAL( seg1.lastPoint(), line1.pointAt(lastIndex) );
GEOM_CHECK_NULL( geom::angle(seg1, line1 ) );
test_segment( seg1 );
JFR_CHECK( !seg1.isTransformable() );
// Test constructor based on two points
SegmentD seg2( new typename SegmentD::TwoPointsPointerDriver( &point1, &point2 ) );
test_segment_validity( seg2 );
GEOM_CHECK_VEC_EQUAL( seg2.firstPoint(), point1.homogenousCoordinates() );
GEOM_CHECK_VEC_EQUAL( seg2.lastPoint(), point2.homogenousCoordinates() );
test_segment( seg2 );
JFR_CHECK( !seg2.isTransformable() );
// Test constructor based on two points
SegmentD seg3( new typename SegmentD::TwoPointsDriver( point1.homogenousCoordinates(), point2.homogenousCoordinates() ) );
test_segment_validity( seg3 );
GEOM_CHECK_VEC_EQUAL( seg3.firstPoint(), point1.homogenousCoordinates() );
GEOM_CHECK_VEC_EQUAL( seg3.lastPoint(), point2.homogenousCoordinates() );
test_segment( seg3 );
JFR_CHECK( seg3.isTransformable() );
// Test transformability
HomogenousMatrixD m = random_inversible_mat<dimension>();
HomogenousMatrixD mInv;
jmath::ublasExtra::inv( m, mInv );
SegmentD seg3bis = seg3;
seg3bis.applyTransformation( m );
GEOM_CHECK_VEC_EQUAL( seg3bis.firstPoint(), ublas::prod(m, seg3.firstPoint() ) );
GEOM_CHECK_VEC_EQUAL( seg3bis.lastPoint(), ublas::prod(m, seg3.lastPoint() ) );
seg3bis.applyTransformation( mInv );
GEOM_CHECK_VEC_EQUAL( seg3bis.firstPoint(), seg3.firstPoint() );
GEOM_CHECK_VEC_EQUAL( seg3bis.lastPoint(), seg3.lastPoint() );
// Test distance
test_distance(seg1, seg2);
test_distance(seg2, seg3);
test_distance(seg1, seg3);
test_distance(seg1, seg2.support());
test_distance(seg1, seg3.support());
test_distance(seg2, seg1.support());
test_distance(seg2, seg3.support());
test_distance(seg3, seg2.support());
test_distance(seg3, seg1.support());
}
开发者ID:nelsonn3c,项目名称:monoc_slam_lsa,代码行数:56,代码来源:test_suite_segment.cpp
注:本文中的point1函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论