FixtureDef* TiledBodyCreator::createFixture(cocos2d::ValueMap object) { int fixtureType = RECT_FIXTURE; for(auto propObj : object) { if(propObj.first == "points") { fixtureType = POLYGON_FIXTURE; } else if(propObj.first == "polylinePoints") { fixtureType = POLYLINE_FIXTURE; } } if(object["type"].asString() == "Circle") { fixtureType = CIRCLE_FIXTURE; } if(fixtureType == POLYGON_FIXTURE) { return createPolygon(object); } else if(fixtureType == POLYLINE_FIXTURE) { return createPolyline(object); } else if(fixtureType == CIRCLE_FIXTURE) { return createCircle(object); } else if(fixtureType == RECT_FIXTURE) { return createRect(object); } }
//空外接圆检测 bool isInCircle(float px, float py) { if (r < 0) createCircle(); float pr = len(x, y, px, py); if (pr <= r) return true; return false; }
Model2D createLRFPose() { Model2D model = createCircle(0.1); Contour2D& c = model.addContour(); c.addPoint(0, 0); c.addPoint(0.2, 0); return model; }
int main(){ const int X=1; const int Y=2; const unsigned int R=3; circle myCircle=createCircle(X,Y,R); box myBox=createBox(myCircle); printBound(myBox); return 0; }
/** Constructor */ CreateCircleDialog::CreateCircleDialog() : QDialog(NULL, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint) { /* Invoke the Qt Designer generated object setup routine */ ui.setupUi(this); /* Setup Queue */ mCircleQueue = new TokenQueue(rsGxsCircles->getTokenService(), this); mIdQueue = new TokenQueue(rsIdentity->getTokenService(), this); ui.headerFrame->setHeaderImage(QPixmap(":/images/circles/circles_64.png")); // connect up the buttons. connect(ui.addButton, SIGNAL(clicked()), this, SLOT(addMember())); connect(ui.removeButton, SIGNAL(clicked()), this, SLOT(removeMember())); connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(createCircle())); connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(close())); connect(ui.treeWidget_membership, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), this, SLOT(selectedMember(QTreeWidgetItem*, QTreeWidgetItem*))); connect(ui.treeWidget_IdList, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), this, SLOT(selectedId(QTreeWidgetItem*, QTreeWidgetItem*))); connect(ui.treeWidget_IdList, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(IdListCustomPopupMenu(QPoint))); connect(ui.treeWidget_membership, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(MembershipListCustomPopupMenu(QPoint))); connect(ui.IdFilter, SIGNAL(textChanged(QString)), this, SLOT(filterChanged(QString))); //connect(ui.toolButton_NewId, SIGNAL(clicked()), this, SLOT(createNewGxsId())); /* Add filter actions */ QTreeWidgetItem *headerItem = ui.treeWidget_IdList->headerItem(); QString headerText = headerItem->text(RSCIRCLEID_COL_NICKNAME); ui.IdFilter->addFilter(QIcon(), headerText, RSCIRCLEID_COL_NICKNAME, QString("%1 %2").arg(tr("Search"), headerText)); headerText = headerItem->text(RSCIRCLEID_COL_KEYID); ui.IdFilter->addFilter(QIcon(), headerText, RSCIRCLEID_COL_KEYID, QString("%1 %2").arg(tr("Search"), headerText)); ui.removeButton->setEnabled(false); ui.addButton->setEnabled(false); ui.radioButton_ListAll->setChecked(true); QObject::connect(ui.radioButton_ListAll, SIGNAL(toggled(bool)), this, SLOT(idTypeChanged())) ; QObject::connect(ui.radioButton_ListAllPGP, SIGNAL(toggled(bool)), this, SLOT(idTypeChanged())) ; QObject::connect(ui.radioButton_ListKnownPGP, SIGNAL(toggled(bool)), this, SLOT(idTypeChanged())) ; QObject::connect(ui.radioButton_Public, SIGNAL(toggled(bool)), this, SLOT(updateCircleType(bool))) ; QObject::connect(ui.radioButton_Self, SIGNAL(toggled(bool)), this, SLOT(updateCircleType(bool))) ; QObject::connect(ui.radioButton_Restricted, SIGNAL(toggled(bool)), this, SLOT(updateCircleType(bool))) ; ui.radioButton_Public->setChecked(true) ; mIsExistingCircle = false; mIsExternalCircle = true; mClearList = true; //ui.idChooser->loadIds(0,RsGxsId()); ui.circleComboBox->loadCircles(GXS_CIRCLE_CHOOSER_EXTERNAL, RsGxsCircleId()); }
void LSS10() { CLogger::Print(_T("-------------| START LOGGING LESSONS 10 |--------------")); AcDbObjectId idCircle; Acad::ErrorStatus es; if (Acad::eOk != (es = createCircle(idCircle))) { acutPrintf(ACRX_T("Fail to call createCircle() function - Error: %s") , acadErrorStatusText(es)); } }
int main( void ) { /*** Declare all variables ***/ // unsigned short circle[N][N] = {BG}; // unsigned short circleBitmap[N]; /*** Declare all variables ***/ SystemInit(); GLCD_Init(); GLCD_Clear(BG); createCircle(160, 120); while(1); }
Model2D createTurtleModel() { double radius = 0.3; double bla = sqrt(2.0) / 2 * radius; Model2D m = createCircle(radius); Contour2D& c1 = m.addContour(); c1.addPoint(0, 0); c1.addPoint(bla, bla); Contour2D& c2 = m.addContour(); c2.addPoint(0, 0); c2.addPoint(bla, -bla); return m; }
void PatternGenerator::setSequence(Sequence* sequence) { assert(sequence); m_sequence = sequence; Device* device = _app->doc()->device(sequence->device()); assert(device); t_channel channels = device->deviceClass()->channels()->count(); bool horizontal = false; bool vertical = false; QString s; for (t_channel ch = 0; ch < channels; ch++) { LogicalChannel* c = device->deviceClass()->channels()->at(ch); assert(c); // Insert ch:name strings to combos s.sprintf("%d:" + c->name(), ch); m_horizontalCombo->insertItem(s); m_verticalCombo->insertItem(s); // Select the first channel that contains the word "pan" if (horizontal == false && c->name().contains("pan", false)) { m_horizontalCombo->setCurrentItem(ch); m_horizontalChannel = ch; horizontal = true; } // Select the first channel that contains the word "tilt" if (vertical == false && c->name().contains("tilt", false)) { m_verticalCombo->setCurrentItem(ch); m_verticalChannel = ch; vertical = true; // Select the first that contains "tilt" } } createCircle(); }
int main(int argc, char *argv[]) { FILE * fin = NULL; FILE * fout = NULL; char ltr[MAX]; char lineOne[MAX]; char lineTwo[MAX]; char outputName[MAX]; int edgeWidth, centerRow, centerColumn, radius; int ** imageNumbers = NULL; int rows, columns, intensity; int i; fin = openFile(argc, argv, ltr, &edgeWidth, ¢erRow, ¢erColumn, &radius, outputName); fout = fopen(outputName, "w"); readFileHeader(fin, &rows, &columns, &intensity, lineOne, lineTwo); imageNumbers = (int**) malloc(rows * sizeof(int*)); for(i = 0; i < rows; i++) imageNumbers[i] = (int*)malloc(columns * sizeof(int)); fill2DArray(imageNumbers, rows, columns, fin); if(strcmp(ltr, "-e") == 0) createBorder(imageNumbers, rows, columns, edgeWidth); else createCircle(imageNumbers, centerRow, centerColumn, radius, rows, columns); intensity = findMax2DArray(imageNumbers,rows,columns); printArray2DToFile(imageNumbers, rows, columns, fout, lineOne, outputName, intensity); cleanUp(imageNumbers,rows); if(fin != NULL) fclose(fin); if(fout != NULL) fclose(fout); return 0; }
cpShape *cpSpaceSerializer::createShape(TiXmlElement *elm) { cpShape *shape; const char* type = elm->Attribute("type"); if (stringEquals(type, "circle")) shape = createCircle(elm); else if (stringEquals(type, "segment")) shape = createSegment(elm); else if (stringEquals(type, "poly")) shape = createPoly(elm); else return NULL; CPSS_ID id = createValue<CPSS_ID>("id", elm); _shapeMap[id] = shape; shape->sensor = createValue<int>("sensor", elm); shape->e = createValue<cpFloat>("e", elm); shape->u = createValue<cpFloat>("u", elm); shape->surface_v = createPoint("surface_v", elm); shape->collision_type = createValue<cpCollisionType>("collision_type", elm); shape->group = createValue<cpGroup>("group", elm); shape->layers = createValue<cpLayers>("layers", elm); if (delegate) { if (!delegate->reading(shape, id)) { if (shape->body != _space->staticBody) cpBodyFree(shape->body); cpShapeFree(shape); shape = NULL; } } return shape; }
void PatternGenerator::slotYOffsetSpinChanged(int value) { m_yOffset = value; createCircle(); }
void PatternGenerator::slotHeightSpinChanged(int value) { m_height = value; createCircle(); }
void PatternGenerator::slotWidthSpinChanged(int value) { m_width = value; createCircle(); }
void relativeSection(ImageWriter& iw) { iw.setLabel("relative"); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - WorldModel2D wm; // wm.addEntity(createBox(geo::Vec2(), geo::Vec2())); // wm.addEntity(createBox(7.63, 4.09, true), fromXYADegrees(0.085, 0.065, 0)); wm.addEntity(createBox(geo::Vec2(0, -4.09), geo::Vec2(7.63, 0), true), fromXYADegrees(-3.75, 2.1, 0)); int idx_couch = wm.entities.size(); wm.addEntity(createBox(0.691667, 1.45833), fromXYADegrees(-0.529166, 0.404165, 0)); wm.addEntity(createBox(0.45833, 0.6), fromXYADegrees(-1.69583, 0.375, 0)); wm.addEntity(createBox(0.95833, 0.516667), fromXYADegrees(-1.72917, -0.616667, 0)); wm.addEntity(createBox(0.96666, 0.50833), fromXYADegrees(-1.75, 1.37084, 0)); wm.addEntity(createBox(1.6, 0.30834), fromXYADegrees(-0.45, -1.8375, 0)); int idx_table = wm.entities.size(); wm.addEntity(createBox(0.65, 0.95), fromXYADegrees(1.6, 0.4, 0)); int idx_cabinet = wm.entities.size(); wm.addEntity(createBox(0.55, 1.28333), fromXYADegrees(3.54167, 0.558333, 0)); wm.addEntity(createCircle(0.1), fromXYA(0.358333, 1.81667, 0)); wm.addEntity(createCircle(0.1), fromXYA(-1.73333, -1.78333, 0)); int idx_plant = wm.entities.size(); wm.addEntity(createCircle(0.1), fromXYA(3.18333, 1.68333, 0)); Model2D model; Contour2D& c = model.addContour(); c.addPoint(-3.73333 + 3.3, -1 + 1.6); c.addPoint(-3.15 + 3.3, -1 + 1.6); c.addPoint(-3.15 + 3.3, -1.46 + 1.6); c.addPoint(-2.36 + 3.3, -1.46 + 1.6); c.addPoint(-2.36 + 3.3, -1.97 + 1.6); c.addPoint(-3.73333 + 3.3, -1.97 + 1.6); wm.addEntity(model, fromXYADegrees(-3.3, -1.6, 0)); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Canvas canvas = iw.nextCanvas(); drawImage(canvas, iw.image_path() + "/livingroom.jpg", 0.9); iw.process(canvas); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - drawWorld(canvas, wm); iw.process(canvas); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - int idx_lrf = wm.entities.size(); wm.addEntity(createLRFPose(), fromXYADegrees(0.533333, -1.24167, 145), Color(0, 150, 0, 2)); drawWorld(canvas, wm); iw.process(canvas); int idx_target = wm.entities.size(); wm.addEntity(createTarget(), fromXYADegrees(-0.533333, -0.725, 0), Color(255, 0, 0, 2)); drawWorld(canvas, wm); iw.process(canvas); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // Moved couch canvas = iw.nextCanvas(); drawImage(canvas, iw.image_path() + "/livingroom2.jpg", 0.9); drawWorld(canvas, wm); iw.process(canvas); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // canvas = iw.nextCanvas(); drawWorldModelAbsolute(canvas, wm, wm.entities[0].pose.t); iw.process(canvas); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - canvas = iw.nextCanvas(); drawImage(canvas, iw.image_path() + "/livingroom2.jpg", 0.9); drawWorld(canvas, wm); iw.process(canvas); std::vector<Link> links; links.push_back(Link(0, idx_target)); links.push_back(Link(0, idx_lrf)); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - drawWorldModelSceneGraph(canvas, wm, links); iw.process(canvas); canvas = iw.nextCanvas(); drawImage(canvas, iw.image_path() + "/livingroom2.jpg", 0.9); drawWorld(canvas, wm); iw.process(canvas); links.clear(); links.push_back(Link(idx_couch, idx_target)); drawWorldModelSceneGraph(canvas, wm, links); iw.process(canvas); links.push_back(Link(idx_lrf, idx_couch)); drawWorldModelSceneGraph(canvas, wm, links); iw.process(canvas); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - WorldModel2D wm2; wm2.entities.push_back(wm.entities[idx_lrf]); wm2.entities.push_back(wm.entities[idx_couch]); wm2.entities.push_back(wm.entities[idx_target]); links.clear(); links.push_back(Link(0, 1)); links.push_back(Link(1, 2)); canvas = iw.nextCanvas(); drawWorldModelSceneGraph(canvas, wm2, links); iw.process(canvas); canvas = iw.nextCanvas(); drawImage(canvas, iw.image_path() + "/livingroom2.jpg", 0.9); wm.entities[idx_target].pose.t.y += 0.7; wm.entities[idx_couch].pose.t.y += 0.7; links.clear(); links.push_back(Link(idx_couch, idx_target)); links.push_back(Link(idx_lrf, idx_couch)); drawWorldModelSceneGraph(canvas, wm, links); iw.process(canvas); links.push_back(Link(idx_couch, 2)); links.push_back(Link(2, 3)); links.push_back(Link(2, 4)); links.push_back(Link(idx_lrf, idx_table)); links.push_back(Link(idx_table, idx_cabinet)); links.push_back(Link(idx_cabinet, idx_plant)); drawWorldModelSceneGraph(canvas, wm, links); iw.process(canvas); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // Soccer field iw.setLabel("relative-soccer"); //Click: [ -2.0125 -0.0125 ] //Click: [ 0.8375 -1.1 ] //Click: [ 2.075 0.025 ] //Click: [ 2 1.7125 ] ball wm.entities.clear(); wm.addEntity(createSoccerFieldModel(), geo::Transform2::identity(), Color(255, 255, 255, 2)); wm.addEntity(createCircle(0.2), fromXYA(2, 1.7125, 0), Color(255, 220, 0, 2)); wm.addEntity(createTurtleModel(), fromXYADegrees(0.8375, -1.1 , 60), Color(0, 0, 0, 2)); // wm.addEntity(createTurtleModel(), fromXYADegrees(-1.1, -0.15, -90), Color(0, 0, 0, 2)); // wm.addEntity(createTurtleModel(), fromXYADegrees(2.275, 0.025, 105), Color(0, 0, 0, 2)); canvas = iw.nextCanvas(); drawSoccerField(canvas); drawWorld(canvas, wm); iw.process(canvas); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - drawWorldModelAbsolute(canvas, wm, geo::Vec2(-4, 2.67)); iw.process(canvas); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - links.clear(); links.push_back(Link(2, 1)); canvas = iw.nextCanvas(); drawSoccerField(canvas); drawWorldModelSceneGraph(canvas, wm, links); iw.process(canvas); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - wm.addEntity(createTurtleModel(), fromXYADegrees(-1.5, -0.15, -10), Color(0, 0, 0, 2)); canvas = iw.nextCanvas(); drawSoccerField(canvas); drawWorldModelSceneGraph(canvas, wm, links); iw.process(canvas); links.push_back(Link(3, 2)); drawWorldModelSceneGraph(canvas, wm, links); iw.process(canvas); drawArrow(canvas, wm.entities[3].pose.t, wm.entities[1].pose.t, Color(150, 150, 150, 2), true); iw.process(canvas); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - canvas = iw.nextCanvas(); drawSoccerField(canvas); geo::Vec2 ball_pos_rel = wm.entities[2].pose.inverse() * wm.entities[1].pose.t; geo::Transform2 offset = geo::Transform2::identity(); offset.setRotation(-0.3); wm.entities[2].pose = wm.entities[2].pose * offset; wm.entities[1].pose.t = wm.entities[2].pose * ball_pos_rel; drawWorldModelSceneGraph(canvas, wm, links); drawArrow(canvas, wm.entities[3].pose.t, wm.entities[1].pose.t, Color(150, 150, 150, 2), true); iw.process(canvas); // Turn back wm.entities[2].pose = wm.entities[2].pose * offset.inverse(); wm.entities[1].pose.t = wm.entities[2].pose * ball_pos_rel; // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - canvas = iw.nextCanvas(); drawSoccerField(canvas); drawWorld(canvas, wm); iw.process(canvas); // wm.addEntity(createTurtleModel(), fromXYADegrees(2.275, 0.025, 105), Color(0, 0, 0, 2)); wm.addEntity(createTurtleModel(), fromXYADegrees(0.375, 0.65, -105), Color(0, 0, 0, 2)); drawWorld(canvas, wm); iw.process(canvas); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - links.clear(); links.push_back(Link(2, 1)); links.push_back(Link(2, 4)); drawWorldModelSceneGraph(canvas, wm, links); iw.process(canvas); // links.push_back(Link(4, 1)); // drawWorldModelSceneGraph(canvas, wm, links); // iw.process(canvas); links.push_back(Link(3, 2)); links.push_back(Link(3, 4)); drawWorldModelSceneGraph(canvas, wm, links); iw.process(canvas); cv::Mat temp = canvas.image.clone(); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - canvas = iw.nextCanvas(); canvas.image = temp.clone(); drawTriangle(canvas, wm.entities[1].pose.t, wm.entities[2].pose.t, wm.entities[4].pose.t, Color(0, 255, 255, 2)); iw.process(canvas); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // Replace 3th turtle by field feature wm.entities[4] = Entity2D(Model2D(), fromXYA(0, 0.7, 0), Color()); canvas = iw.nextCanvas(); drawSoccerField(canvas); drawWorldModelSceneGraph(canvas, wm, links); iw.process(canvas); drawTriangle(canvas, wm.entities[1].pose.t, wm.entities[2].pose.t, wm.entities[4].pose.t, Color(0, 255, 255, 2)); iw.process(canvas); }
void lrfExample(ImageWriter& iw) { iw.setLabel("lrf-example"); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - WorldModel2D wm; // wm.addEntity(createBox(geo::Vec2(), geo::Vec2())); wm.addEntity(createBox(7.63, 4.09, true), fromXYADegrees(0.085, 0.065, 0)); wm.addEntity(createBox(0.691667, 1.45833), fromXYADegrees(-0.529166, 0.404165, 0)); wm.addEntity(createBox(0.45833, 0.6), fromXYADegrees(-1.69583, 0.375, 0)); wm.addEntity(createBox(0.95833, 0.516667), fromXYADegrees(-1.72917, -0.616667, 0)); wm.addEntity(createBox(0.96666, 0.50833), fromXYADegrees(-1.75, 1.37084, 0)); wm.addEntity(createBox(1.6, 0.30834), fromXYADegrees(-0.45, -1.8375, 0)); wm.addEntity(createBox(0.65, 0.95), fromXYADegrees(1.6, 0.4, 0)); wm.addEntity(createBox(0.55, 1.28333), fromXYADegrees(3.54167, 0.558333, 0)); wm.addEntity(createCircle(0.1), fromXYA(0.358333, 1.81667, 0)); wm.addEntity(createCircle(0.1), fromXYA(-1.73333, -1.78333, 0)); wm.addEntity(createCircle(0.1), fromXYA(3.18333, 1.68333, 0)); Model2D model; Contour2D& c = model.addContour(); c.addPoint(-3.73333 + 3.3, -1 + 1.6); c.addPoint(-3.15 + 3.3, -1 + 1.6); c.addPoint(-3.15 + 3.3, -1.46 + 1.6); c.addPoint(-2.36 + 3.3, -1.46 + 1.6); c.addPoint(-2.36 + 3.3, -1.97 + 1.6); c.addPoint(-3.73333 + 3.3, -1.97 + 1.6); wm.addEntity(model, fromXYADegrees(-3.3, -1.6, 0)); // wm.addEntity(createBox(geo::Vec2(0, -4), geo::Vec2(8, 0), true), fromXYA(-4, 2, 0)); // 0 // wm.addEntity(createBox(1.6, 0.8), fromXYA(2, -1, 0)); // 1 table // wm.addEntity(createCircle(0.1), fromXYA(2.6, -0.8, 0)); // 2 small object // wm.addEntity(createCircle(0.5), fromXYA(-3.2, -1.2, 0)); // 3 // wm.addEntity(createCircle(0.3), fromXYA(-2.2, -1.4, 0)); // 4 // wm.addEntity(createCircle(0.3), fromXYA(3.3, 1.0, 0)); // 5 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - geo::LaserRangeFinder lrf; lrf.setNumBeams(50); lrf.setAngleLimits(-1.0, 1.0); lrf.setRangeLimits(0, 10); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // Draw world model without extra object Canvas canvas = iw.nextCanvas(); drawImage(canvas, iw.image_path() + "/livingroom.jpg", 0.9); iw.setLabel("livingroom"); iw.process(canvas); iw.setLabel("lrf-example"); iw.process(canvas); // canvas = iw.nextCanvas(); // drawWorld(canvas, wm); // iw.process(canvas); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // Render world model (LRF) without extra object (virtual data) geo::Transform2 lrf_pose = fromXYADegrees(0.533333, -1.24167, 145); drawLRFPose(canvas, lrf_pose, Color(0, 150, 0, 2)); iw.process(canvas); std::vector<double> ranges_virtual = renderLRF(lrf, lrf_pose, wm); drawRanges(canvas, lrf, lrf_pose, ranges_virtual, Color(255, 0, 0, 3), Color(50, 50, 50)); drawLRFPose(canvas, lrf_pose, Color(0, 150, 0, 2)); iw.process(canvas); drawWorld(canvas, wm); drawRanges(canvas, lrf, lrf_pose, ranges_virtual, Color(255, 0, 0, 3), Color(50, 50, 50)); drawLRFPose(canvas, lrf_pose, Color(0, 150, 0, 2)); iw.process(canvas); canvas = iw.nextCanvas(); drawWorld(canvas, wm); drawRanges(canvas, lrf, lrf_pose, ranges_virtual, Color(255, 0, 0, 3), Color(50, 50, 50)); drawLRFPose(canvas, lrf_pose, Color(0, 150, 0, 2)); iw.process(canvas); }
void xray_jit_levelsetseg_calculate_ndim(t_xray_jit_levelsetseg *obj, long dimcount, long *dim, long planecount, t_jit_matrix_info *in1_minfo, char *bip1, t_jit_matrix_info *phi_minfo, char *phi_bp, t_jit_matrix_info *out1_minfo, char *bop1, t_jit_matrix_info *out2_minfo, char *bop2) { long x, y; uchar *ip1, *op2; char *phi; long height,width; long inrowspan, phi_rowspan; long out2rowspan; t_RegionStats *inside, *outside; float *fop1; if (dimcount<1) return; //safety switch(dimcount) { case 1: dim[1]=1; case 2: width = in1_minfo->dim[0]; height = in1_minfo->dim[1]; inrowspan = in1_minfo->dimstride[1]; phi_rowspan = phi_minfo->dimstride[1]; out2rowspan = out2_minfo->dimstride[1]; if (out2_minfo->type==_jit_sym_char) { inside = obj->inside; outside = obj->outside; if( !(obj->evolve) ) { DLLfreeListNodes(obj->L_in); DLLfreeListNodes(obj->L_out); clearRegionDistribution(inside); clearRegionDistribution(outside); for(x=0; x < obj->pointcount/2; x++) { createCircle(obj, obj->point[2*x], obj->point[2*x+1], obj->L_in, obj->L_out, phi_bp, phi_minfo); } for(y=0; y < in1_minfo->dim[1]; y++) { ip1 = (uchar *)(bip1 + y*inrowspan); phi = (phi_bp + y*phi_rowspan); for(x=0; x < in1_minfo->dim[0]; x++) { if(phi[x] >= L_OUT) { outside->sum += (double)ip1[x]; outside->sumSq += (double)ip1[x]*(double)ip1[x]; outside->count++; } else { inside->sum += (double)ip1[x]; inside->sumSq += (double)ip1[x]*(double)ip1[x]; inside->count++; } } } calcRegionStats(inside); calcRegionStats(outside); } for(y=0; y < obj->cycles; y++) { for(x=0; x < obj->Na; x++) { evolveCurve(obj->L_in, obj->L_out, inside, outside, bip1, in1_minfo, phi_bp, phi_minfo); adjustRegionStats(inside, outside); } for(x=0; x < obj->Ns; x++) { smoothCurve(obj->L_in, obj->L_out, inside, outside, bip1, in1_minfo, phi_bp, phi_minfo, obj->Ng, obj->gaussKernel); adjustRegionStats(inside, outside); } if( stoppingConditions(obj->L_in, obj->L_out, inside, outside, bip1, in1_minfo, phi_bp, phi_minfo) ) { break; } } for(y=0; y < out2_minfo->dim[1]; y++) { ip1 = (uchar *)(phi_bp + y*(phi_minfo->dimstride[1])); op2 = (uchar *)(bop2 + y*(out2_minfo->dimstride[1])); for(x=0; x < out2_minfo->dim[0]; x++) { op2[x] = ip1[x]; } } for(y=0; y < out2_minfo->dim[1]; y++) { ip1 = (uchar *)(bip1 + y*(in1_minfo->dimstride[1])); fop1 = (float *)(bop1 + y*(out1_minfo->dimstride[1])); for(x=0; x < out2_minfo->dim[0]; x++) { //fop1[x] = calcProb(inside, outside, ip1[x]); } } } break; default: ; } }
void PatternGenerator::slotDensitySpinChanged(int value) { m_density = static_cast<double> (value) / 100.0; createCircle(); }
b2Body* Game::createCircle(b2Vec2 position, float radius, b2BodyType bodyType, unsigned short category, unsigned short mask) { return createCircle(position, radius, 0.0f, bodyType, category, mask); }
void init_measurestate() { COMPONENT* lblTitle; COMPONENT* btnRound; COMPONENT* circle; COMPONENT* btnFlat; COMPONENT* rectangle; COMPONENT* btnOval; COMPONENT* oval; COMPONENT* btnRoundRect; COMPONENT* roundrect; int btnWidth, circleWidth, rectWidth, ovalWidth, roundrectWidth; #if DEBUG_STATES > 1 printf("Measure state! \n"); #endif containerClear(); lblTitle = createLabel(LBL_TITLE, "Select spoke type:", 10, 5); if (!lblTitle) { // error } circle = createCircle(NAME_CIRCLE, 0, componentGetBottom(lblTitle) + 5, CIRCLE_RADIUS, 0x00FF0000, GUI_PEN_SOLID); if (!circle) { // error } btnRound = createButton(BTN_ROUND, "Round spoke", 20, componentGetBottom( circle) + 2); if (!btnRound) { // error } rectangle = createRectangle(NAME_RECT, 0, componentGetBottom(btnRound) + 5, RECT_WIDTH, RECT_HEIGHT, 0x00FF0000, GUI_PEN_SOLID); if (!rectangle) { // error } btnFlat = createButton(BTN_FLAT, "Flatten spoke", 20, componentGetBottom( rectangle) + 2); if (!btnFlat) { // error } oval = createOval(NAME_RECT, 0, componentGetBottom(btnFlat) + 5, OVAL_X, OVAL_Y, 0x00FF0000, GUI_PEN_SOLID); if (!oval) { // error } btnOval = createButton(BTN_OVAL, "Oval spoke", 20, componentGetBottom(oval) + 2); if (!btnOval) { // error } roundrect = createRoundrect(NAME_ROUND_RECT, 0, componentGetBottom(btnOval) + 5, RND_RECT_OUTER_WIDTH, RND_RECT_INNER_WIDTH, RND_RECT_HEIGHT, 0x00FF0000, GUI_PEN_SOLID); if (!roundrect) { // error } btnRoundRect = createButton(BTN_ROUNDRECT, "Rounded rect spoke", 20, componentGetBottom(roundrect) + 2); if (!btnRoundRect) { // error } btnWidth = componentGetWidth(btnRound); circleWidth = componentGetWidth(circle); rectWidth = componentGetWidth(rectangle); ovalWidth = componentGetWidth(oval); roundrectWidth = componentGetWidth(roundrect); componentSetX(circle, (btnWidth - circleWidth) / 2 + componentGetX(btnRound)); btnWidth = componentGetWidth(btnFlat); componentSetX(rectangle, (btnWidth - rectWidth) / 2 + componentGetX(btnFlat)); btnWidth = componentGetWidth(btnOval); componentSetX(oval, (btnWidth - ovalWidth) / 2 + componentGetX(btnOval)); btnWidth = componentGetWidth(btnRoundRect); componentSetX(roundrect, (btnWidth - roundrectWidth) / 2 + componentGetX( btnRoundRect)); #if DEBUG_STATES > 1 printf("Rectangle:\nx: %d\ny: %d\nwidth: %d\nheight: %d\n", componentGetX( rectangle), componentGetY(rectangle), componentGetWidth(rectangle), componentGetHeight(rectangle)); fflush(stdout); #endif }