bool BVolPointLocation<BasicTraits>::InitPointLocation (GeneralType*, const TransformType& m) { m_hit = NULL; TransformType inv; inv.invertFrom(m); inv.mult(getPoint(), m_local); return true; }
Side PredWrapper::doInsphereFast( Tet tet, int v ) const { if ( v == _infIdx || tet.has( _infIdx ) ) return SideZero; const RealType* p[] = { getPoint( tet._v[0] )._p, getPoint( tet._v[1] )._p, getPoint( tet._v[2] )._p, getPoint( tet._v[3] )._p, getPoint( v )._p }; const RealType det = inspherefast( p[0], p[1], p[2], p[3], p[4] ); const Side s = sphToSide( det ); return s; }
glm::vec3 CompositorHelper::sphereSurfaceFromOverlay(const glm::vec2& overlay) const { auto spherical = overlayToSpherical(overlay); // FIXME use a GLMHelper sphericalToCartesian after fixing the rotation signs. auto sphereSurfacePoint = getPoint(spherical.x, spherical.y); auto UITransform = getUiTransform(); auto position4 = UITransform * vec4(sphereSurfacePoint, 1); return vec3(position4) / position4.w; }
void GLVertexGridDirect::setTexCoord(int i, int j) { Vec2 p; for (int k = 0; k < numLayers; k++) { getPoint(k, i, j, p); glMultiTexCoord2f(GL_TEXTURE0 + k, p.x*gridw[k], p.y*gridh[k]); } }
bool SquareDomainSquareHole::isFeasible(GridPointIndex *x) { if (x != NULL) { State *s = getPoint(x); bool ret = isFeasible(s); delete[] s; return ret; } return false; }
void Sphere::getRandomPoint(SurfacePoint &pt) { if (!m_surfaceSampler) m_surfaceSampler = new UniformOnSphereSampler(); pt.position = m_transToWorld * m_surfaceSampler->sample().getValue<Point3>(); _getUV(pt); getPoint(pt, pt.uv); }
void Viewer::mouse_double_right_click_event( QMouseEvent *e ) { boost::optional< QVector3D > point = getPoint( e->pos() ); if( !point ) { std::cerr << "warning: no point found near the double right click" << std::endl; return; } Eigen::Vector3d p( point->x(), point->y(), point->z() ); if( !m_offset ) { std::cerr << "warning: offset is not defined yet, wait until it is found first" << std::endl; return; } p += *m_offset; std::cout << std::setprecision(16) << p.x() << "," << p.y() << "," << p.z() << std::endl; }
Action::Create3dPrimitive* CreatePrimitiveWidget::createBoxAction() const { gp_Ax3 axis(getPoint(), getDir()); float height = getHeight(); float width = getWidth(); float lenght = getLength(); return new Action::CreateBox(axis, height, width, lenght); }
bool SquareDomainRoundHole::isFeasible(GridPointIndex *x, Player p) { if (x != NULL) { State *s = getPoint(x); bool ret = isFeasible(s, p); delete[] s; return ret; } return false; }
double Coeff(int *pt, int di, double shift, myCSField sf) { double x[sf->d]; getPoint(pt, x, sf); x[di] += shift; /* double xx=0.5; */ /* printf("x=%.12f, field=%f\n", xx, CalcCoeff(&xx, sf)); */ /* assert(0); */ return CalcCoeff(x, sf); }
TrajectoryPtr Trajectory::clone() const { TrajectoryPtr res(new Trajectory(rns,name)); for (unsigned int i=0;i<getNrOfPoints();i++) { res->addPoint(getPoint(i)); } return res; }
Orient PredWrapper::doOrient3DFast( int v0, int v1, int v2, int v3 ) const { assert( ( v0 != v1 ) && ( v0 != v2 ) && ( v0 != v3 ) && ( v1 != v2 ) && ( v1 != v3 ) && ( v2 != v3 ) && "Duplicate indices in orientation!" ); const Point3 p[] = { getPoint( v0 ), getPoint( v1 ), getPoint( v2 ), getPoint( v3 ) }; RealType det = orient3dfast( p[0]._p, p[1]._p, p[2]._p, p[3]._p ); if ( (v0 == _infIdx) || (v1 == _infIdx) || (v2 == _infIdx) || (v3 == _infIdx) ) det = -det; return ortToOrient( det ); }
void Curve::calculateLength() { /* Calculate length. First, take a simple guess. The real length * will probably be smaller. */ float simpleGuess = getLengthGuess(); float increment = 1.0f / simpleGuess; /* Now approximate the real length. */ length = 0.0f; /* getPoint(0.0f) equals start, so... */ Vector2D previous = getPoint(0.0f), current; for(float t = increment; t <= 1.0f; t += increment) { current = getPoint(t); length += previous.getDistance(current); previous = current; } }
bool MoveResult::operator==(const MoveResult& other) const { return true && _isPlayerSet(mgen::SHALLOW) == other._isPlayerSet(mgen::SHALLOW) && _isPointSet(mgen::SHALLOW) == other._isPointSet(mgen::SHALLOW) && _isRemovedSet(mgen::SHALLOW) == other._isRemovedSet(mgen::SHALLOW) && getPlayer() == other.getPlayer() && getPoint() == other.getPoint() && getRemoved() == other.getRemoved(); }
void Ray::transformAffine(const Matrix4& matrix) { Vector3 end = getPoint(1.0f); mOrigin = matrix.multiplyAffine(mOrigin); end = matrix.multiplyAffine(end); mDirection = Vector3::normalize(end - mOrigin); }
Action::Create3dPrimitive* CreatePrimitiveWidget::createConeAction() const { gp_Ax3 axis(getPoint(), getDir()); float radius1 = getRadius1(); float radius2 = getRadius2(); float height = getHeight(); float angle = getAngle(); return new Action::CreateCone(axis, radius1, radius2, height, angle); }
int gnuplot_splot_obj(gnuplot_ctrl *handle, void *obj, void (*getPoint)(void*,gnuplot_point*,int,int), int n, char *title) { int i; int tmpfd ; char name[128] ; char cmd[GP_CMD_SIZE] ; char line[GP_CMD_SIZE] ; if (handle==NULL || getPoint==NULL || (n<1)) return 1; if (handle->nplots > 0) return 1; /* Open one more temporary file? */ if (handle->ntmp == GP_MAX_TMP_FILES - 1) { fprintf(stderr, "maximum # of temporary files reached (%d): cannot open more", GP_MAX_TMP_FILES) ; return 1; } /* Open temporary file for output */ sprintf(name, GNUPLOT_TEMPFILE, P_tmpdir); if ((tmpfd=mkstemp(name))==-1) { fprintf(stderr,"cannot create temporary file: exiting plot") ; return 1; } /* Store file name in array for future deletion */ strcpy(handle->to_delete[handle->ntmp], name) ; handle->ntmp ++ ; /* Write data to this file */ gnuplot_point point; for (i=0;i<n;i++) { getPoint(obj,&point,i,n); sprintf(line, "%g %g %g\n", point.x, point.y, point.z) ; write(tmpfd, line, strlen(line)); } close(tmpfd) ; /* Command to be sent to gnuplot */ strcpy(cmd, "splot") ; if (title == NULL) { sprintf(line, "%s \"%s\" with %s", cmd, name, handle->pstyle) ; } else { sprintf(line, "%s \"%s\" title \"%s\" with %s", cmd, name, title, handle->pstyle) ; } /* send command to gnuplot */ gnuplot_cmd(handle, line) ; handle->nplots++ ; return 0; }
bool console::miniParser::getGUInput(wxString expression) { exp = expression; patternNormalize(exp); switch (_wait4type) { case telldata::tn_pnt : return getPoint(); case telldata::tn_box : return getBox(); case TLISTOF(telldata::tn_pnt): return getList(); default: return false;// unexpected type } }
QPointF operator[](quint32 i) const { Vertex v; switch(i) { case 0: v = a; break; case 1: v = b; break; case 2: v = c; break; default: return QPointF(); // to fix a warning } return getPoint(points, size, v.layer, v.sector, layers, v.index, centerPtr); }
bool DiagramList::getPath(QPainterPath &path, float scaleX, float scaleY) { QPointF p; if (getPoint(p,0)) { QPainterPath pp(QPointF(p.x() * scaleX, p.y() * scaleY)); path = pp; size_t nCoords = _coords.size(); for (size_t i = 1; i < nCoords; i++) { getPoint(p,i); path.lineTo(QPointF(p.x() * scaleX, p.y() * scaleY)); } return true; } else return false; }
void SplineTCB<Point>::toHermite(SplineHermite<Point>& s) const { //copy times s.copyTimeBase(*this); int numKeys = getNumKeys(); for(int i=0;i<numKeys;i++) { int a = (i > 0 ? i-1 : 0); int b = (i+1 < numKeys ? i+1 : numKeys-1); const Point& P_1 = getPoint(a); const Point& P0 = getPoint(i); const Point& P1 = getPoint(b); s.getPoint(i) = P0; s.getTangentIn(i)=incomingTangent(i,P_1,P0,P1); s.getTangentOut(i)=outgoingTangent(i,P_1,P0,P1); } }
bool RowsStages::getNextPoint(double* lat, double* lon) { ++m_curr; if (m_curr == m_stages.size()) m_curr = 2; return getPoint(lat, lon); }
EMoveType PointInteract::selectIfIntesect( const OFX::PenArgs& args ) { const Point2 mouse = ofxToGil( args.penPosition ); Point2 p = getPoint(); _offset = p - mouse; double margeCanonical = getMarge() * args.pixelScale.x; EMoveType m = clicPoint( p, mouse, margeCanonical ); return m; }
/** Loads the set of all quads from the specified filename. * \param filename The absolute filename to load the quad file from. */ void QuadSet::init(const std::string &filename) { m_min = Vec3( 99999, 99999, 99999); m_max = Vec3(-99999, -99999, -99999); XMLNode *xml = file_manager->createXMLTree(filename); if(!xml || xml->getName()!="quads") { Log::error("[QuadSet::load] ERROR : QuadSet '%s' not found.", filename.c_str()); delete xml; return; } for(unsigned int i=0; i<xml->getNumNodes(); i++) { const XMLNode *xml_node = xml->getNode(i); if(xml_node->getName()!="quad") { Log::warn("[QuadSet::load] WARNING: Unsupported node type '%s' found in '%s' - ignored.", xml_node->getName().c_str(), filename.c_str()); continue; } // Note that it's not easy to do the reading of the parameters here // in quad, since the specification in the xml can contain references // to previous points. E.g.: // <quad p0="40:3" p1="40:2" p2="25.396030 0.770338 64.796539" ... Vec3 p0, p1, p2, p3; getPoint(xml_node, "p0", &p0); getPoint(xml_node, "p1", &p1); getPoint(xml_node, "p2", &p2); getPoint(xml_node, "p3", &p3); bool invisible=false; xml_node->get("invisible", &invisible); bool ai_ignore=false; xml_node->get("ai-ignore", &ai_ignore); Quad* q=new Quad(p0,p1,p2,p3, invisible, ai_ignore); m_all_quads.push_back(q); m_max.max(p0);m_max.max(p1);m_max.max(p2);m_max.max(p3); m_min.min(p0);m_min.min(p1);m_min.min(p2);m_min.min(p3); } delete xml; } // load
/** * @param num Number of points to calculate * @param out The result is written here */ void Path::getPoints(int num, Vector* out) const { assert(num > 1); assert(num > 1); double t; for (int i = 0; i < num; i++) { t = double(i) / (double(num)); out[i] = getPoint(t); } }
api_point shp_polyline::shapeMiddle( api_point topLeftBound, api_point bottomRightBound ) { api_point p; if( size() > 0 ) { int index = (int)floor((double)size()/2); p = getPoint( index ); int cnt = index; while( !pointInBounds( p, topLeftBound, bottomRightBound ) && cnt < size() ) p = getPoint( ++cnt ); cnt = index; while( !pointInBounds( p, topLeftBound, bottomRightBound) && cnt > 0 ) p = getPoint( --cnt ); return p; } else return p; }
Orient PredWrapper::doOrient4DAdaptSoS( Tet t, int v ) const { assert( t._v[0] != t._v[1] && t._v[0] != t._v[2] && t._v[0] != t._v[3] && t._v[0] != v && t._v[1] != t._v[2] && t._v[1] != t._v[3] && t._v[1] != v && t._v[2] != t._v[3] && t._v[2] != v && t._v[3] != v ); // Fast const RealType* p[] = { getPoint( t._v[0] )._p, getPoint( t._v[1] )._p, getPoint( t._v[2] )._p, getPoint( t._v[3] )._p, getPoint( v )._p }; if ( v == _infIdx ) return doOrient3DSoS( t._v[0], t._v[1], t._v[2], t._v[3] ); if ( t.has( _infIdx ) ) { const int infVi = t.getIndexOf( _infIdx ); const int* ord = TetViAsSeenFrom[ infVi ]; // Check convexity, looking from inside return doOrient3DSoS( t._v[ ord[0] ], t._v[ ord[2] ], t._v[ ord[1] ], v ); } const RealType sph0 = insphere( p[0], p[1], p[2], p[3], p[4] ); const Orient ord0 = sphToOrient( sph0 ); if ( OrientZero != ord0 ) return ord0; // SoS const Orient ord2 = doOrientation4SoSOnly( p[0], p[1], p[2], p[3], p[4], t._v[0], t._v[1], t._v[2], t._v[3], v ); return ord2; }
void AffectorRoad::save (Iff& iff) const { iff.insertForm (TAG_0006); //-- save the base LayerItem::save (iff); //-- save specific data iff.insertForm (TAG_DATA); m_heightData.save (iff); iff.insertChunk (TAG_DATA); iff.insertChunkData (m_pointList.getNumberOfElements ()); int i; for (i = 0; i < m_pointList.getNumberOfElements (); ++i) { iff.insertChunkData (getPoint (i).x); iff.insertChunkData (getPoint (i).y); } iff.insertChunkData (m_heightList.getNumberOfElements ()); for (i = 0; i < m_heightList.getNumberOfElements (); ++i) { iff.insertChunkData (m_heightList[i]); } iff.insertChunkData (getWidth ()); iff.insertChunkData (getFamilyId ()); iff.insertChunkData (static_cast<int32> (getFeatherFunction ())); iff.insertChunkData (getFeatherDistance ()); iff.insertChunkData (static_cast<int32> (getFeatherFunctionShader ())); iff.insertChunkData (getFeatherDistanceShader ()); iff.insertChunkData (m_hasFixedHeights ? static_cast<int32> (1) : static_cast<int32> (0)); iff.exitChunk (TAG_DATA); iff.exitForm (TAG_DATA); iff.exitForm (TAG_0006); }
/** * And Finally, the main method. */ int main(void) { char path[20]; printf("Please enter an input image path: \n"); gets(path); //Yeah, I know its buffer overflow vulnerable. IplImage *img = cvLoadImage(path, CV_LOAD_IMAGE_UNCHANGED); PointImage* out = getPoint(img); calcRoom(out); delete out; cvReleaseImage(&img); return 0; }
void GraphView::paintEvent(QPaintEvent*){ QPixmap backbuffer; backbuffer.convertFromImage (image); QPainter paint(&backbuffer); if(disc){ for(int i = 0; i < disc->numEdge; i++){ int x1,y1,x2,y2; getPoint(x1, y1, disc->verts[disc->edges[i].vert1]); getPoint(x2, y2, disc->verts[disc->edges[i].vert2]); drawEdge(paint,x1,y1,x2,y2); } for(int i = 0; i < disc->numVert; i++){ int x,y; getPoint(x, y, disc->verts[i]); drawCrossHair(paint,x,y); } } paint.end(); bitBlt(this,0,0,&backbuffer,0,0,width(),height(),CopyROP,FALSE); }