当前位置: 首页>>代码示例>>C++>>正文


C++ BBox类代码示例

本文整理汇总了C++中BBox的典型用法代码示例。如果您正苦于以下问题:C++ BBox类的具体用法?C++ BBox怎么用?C++ BBox使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了BBox类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: BWindow

PrefsWindow::PrefsWindow(void)
  : BWindow (BRect (88.0, 108.0, 0.0, 0.0),
      S_PREFSWIN_TITLE,
      B_TITLED_WINDOW,
      B_ASYNCHRONOUS_CONTROLS)
{
  GeneralPrefsView *generalView = new GeneralPrefsView(BRect(0.0, 0.0, 0.0, 0.0),
     "view", B_FOLLOW_ALL_SIDES, B_WILL_DRAW);

  ResizeTo(generalView->Bounds().Width(), generalView->Bounds().Height());

  BBox *box = new BBox (Bounds().InsetByCopy(-1,-1), "box", B_FOLLOW_ALL_SIDES);
  
  AddChild(box);

  box->AddChild(generalView);
  generalView->MoveTo ((box->Bounds().Width() - generalView->Bounds().Width()) / 2,
    (box->Bounds().Height() - generalView->Bounds().Height()) / 2);

  BRect prefsRect (vision_app->GetRect ("GenPrefWinRect"));
  if (prefsRect.Width() != 0.0 && prefsRect.Height() != 0.0)
  {
    ResizeTo (prefsRect.Width(), prefsRect.Height());
    MoveTo (prefsRect.left, prefsRect.top);
  }
}
开发者ID:xray7224,项目名称:Vision,代码行数:26,代码来源:PrefsWindow.cpp

示例2: BView

LookAndFeelSettingsView::LookAndFeelSettingsView(const char* name)
	:
	BView(name, 0),
	fDecorInfoButton(NULL),
	fDecorMenuField(NULL),
	fDecorMenu(NULL)
{
	// Decorator menu
	_BuildDecorMenu();
	fDecorMenuField = new BMenuField("decorator",
		B_TRANSLATE("Decorator:"), fDecorMenu);

	fDecorInfoButton = new BButton(B_TRANSLATE("About"),
		new BMessage(kMsgDecorInfo));

	// scroll bar arrow style
	BBox* arrowStyleBox = new BBox("arrow style");
	arrowStyleBox->SetLabel(B_TRANSLATE("Arrow style"));

	fSavedDoubleArrowsValue = _DoubleScrollBarArrows();

	fArrowStyleSingle = new FakeScrollBar(true, false,
		new BMessage(kMsgArrowStyleSingle));
	fArrowStyleDouble = new FakeScrollBar(true, true,
		new BMessage(kMsgArrowStyleDouble));

	BView* arrowStyleView;
	arrowStyleView = BLayoutBuilder::Group<>()
		.AddGroup(B_VERTICAL, 1)
			.Add(new BStringView("single", B_TRANSLATE("Single:")))
			.Add(fArrowStyleSingle)
			.AddStrut(B_USE_DEFAULT_SPACING)
			.Add(new BStringView("double", B_TRANSLATE("Double:")))
			.Add(fArrowStyleDouble)
			.SetInsets(B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING,
				B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING)
			.End()
		.View();
	arrowStyleBox->AddChild(arrowStyleView);
	arrowStyleBox->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
		B_ALIGN_VERTICAL_CENTER));
	arrowStyleBox->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET));

	BStringView* scrollBarLabel
		= new BStringView("scroll bar", B_TRANSLATE("Scroll bar:"));
	scrollBarLabel->SetExplicitAlignment(
		BAlignment(B_ALIGN_LEFT, B_ALIGN_TOP));

	// control layout
	BLayoutBuilder::Grid<>(this, B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING)
		.Add(fDecorMenuField->CreateLabelLayoutItem(), 0, 0)
		.Add(fDecorMenuField->CreateMenuBarLayoutItem(), 1, 0)
		.Add(fDecorInfoButton, 2, 0)
		.Add(scrollBarLabel, 0, 1)
		.Add(arrowStyleBox, 1, 1)
		.AddGlue(0, 2)
		.SetInsets(B_USE_WINDOW_SPACING);

	// TODO : Decorator Preview Image?
}
开发者ID:looncraz,项目名称:haiku,代码行数:60,代码来源:LookAndFeelSettingsView.cpp

示例3: CalculateEntityBBox

BBox Sketch::CalculateEntityBBox(bool includingInvisible) {
    BBox box = {};
    bool first = true;
    for(int i = 0; i < entity.n; i++) {
        Entity *e = (Entity *)&entity.elem[i];
        if(!(e->IsVisible() || includingInvisible)) continue;

        Vector point;
        double r = 0.0;
        if(e->IsPoint()) {
            point = e->PointGetNum();
        } else {
            switch(e->type) {
                case Entity::ARC_OF_CIRCLE:
                case Entity::CIRCLE:
                    r = e->CircleGetRadiusNum();
                    point = GetEntity(e->point[0])->PointGetNum();
                    break;
                default: continue;
            }
        }

        if(first) {
            box.minp = point;
            box.maxp = point;
            box.Include(point, r);
            first = false;
        } else {
            box.Include(point, r);
        }
    }
    return box;
}
开发者ID:Evil-Spirit,项目名称:solvespace,代码行数:33,代码来源:solvespace.cpp

示例4: testTileBBoxes

// warning: slow
void testTileBBoxes(const MapParams& mp)
{
	// check tile bounding boxes for a few tiles
	for (int64_t tx = -5; tx <= 5; tx++)
		for (int64_t ty = -5; ty <= 5; ty++)
		{
			// get computed BBox
			TileIdx ti(tx,ty);
			BBox bbox = ti.getBBox(mp);

			// this is what the box is supposed to be
			int64_t xmin = 64*mp.B*mp.T*tx - 2*mp.B;
			int64_t ymax = 64*mp.B*mp.T*ty + 17*mp.B;
			int64_t xmax = xmin + mp.tileSize();
			int64_t ymin = ymax - mp.tileSize();

			// test pixels
			for (int64_t x = xmin - 15; x <= xmax + 15; x++)
				for (int64_t y = ymin - 15; y <= ymax + 15; y++)
				{
					bool result = bbox.includes(Pixel(x,y));
					bool expected = x >= xmin && x < xmax && y >= ymin && y < ymax;
					if (result != expected)
					{
						cout << "failed tile bounding box test!  " << tx << " " << ty << endl;
						cout << "[" << bbox.topLeft.x << "," << bbox.topLeft.y << "] to [" << bbox.bottomRight.x << "," << bbox.bottomRight.y << "]" << endl;
						cout << "[" << xmin << "," << ymin << "] to [" << xmax << "," << ymax << "]" << endl;
						cout << x << "," << y << endl;
						return;
					}
				}
		}
}
开发者ID:SupaYoshi,项目名称:pigmap,代码行数:34,代码来源:pigmap.cpp

示例5: BCalendarView

void
DateTimeView::_InitView()
{
	fCalendarView = new BCalendarView("calendar");
	fCalendarView->SetWeekNumberHeaderVisible(false);
	fCalendarView->SetSelectionMessage(new BMessage(kDayChanged));
	fCalendarView->SetInvocationMessage(new BMessage(kDayChanged));

	fDateEdit = new TDateEdit("dateEdit", 3);
	fTimeEdit = new TTimeEdit("timeEdit", 4);
	fClock = new TAnalogClock("analogClock");

	BTime time(BTime::CurrentTime(B_LOCAL_TIME));
	fClock->SetTime(time.Hour(), time.Minute(), time.Second());

	BBox* divider = new BBox(BRect(0, 0, 1, 1),
		B_EMPTY_STRING, B_FOLLOW_ALL_SIDES,
		B_WILL_DRAW | B_FRAME_EVENTS, B_FANCY_BORDER);
	divider->SetExplicitMaxSize(BSize(1, B_SIZE_UNLIMITED));

	const float kInset = be_control_look->DefaultItemSpacing();
	BLayoutBuilder::Group<>(this)
		.AddGroup(B_VERTICAL, kInset / 2)
			.Add(fDateEdit)
			.Add(fCalendarView)
		.End()
		.Add(divider)
		.AddGroup(B_VERTICAL, 0)
			.Add(fTimeEdit)
			.Add(fClock)
		.End()
		.SetInsets(kInset, kInset, kInset, kInset);
}
开发者ID:michael-manley,项目名称:haiku,代码行数:33,代码来源:DateTimeView.cpp

示例6: BVHNode

BVHAccel::BVHAccel(const std::vector<Primitive *> &_primitives,
                   size_t max_leaf_size) 
{

  this->primitives = _primitives;

  // edge case
  if (primitives.empty()) {
    return;
  }

  // calculate root AABB size
  BBox bb;
  for (size_t i = 0; i < primitives.size(); ++i) {
    bb.expand(primitives[i]->get_bbox());
  }
  root = new BVHNode(bb, 0, primitives.size());

  // calculate morton code for each primitives
  for (size_t i = 0; i < primitives.size(); ++i) {
    unsigned int morton_code = morton3D(bb.getUnitcubePosOf(primitives[i]->get_bbox().centroid()));
    primitives[i]->morton_code = morton_code;
  }

  // sort primitives using morton code
  std::sort(primitives.begin(), primitives.end(), mortonCompare);

  //construct BVH based on the mortan code
  constructBVH(root);

}
开发者ID:Jerrypiglet,项目名称:cmu-15462-project-YuMao-RuiZhu,代码行数:31,代码来源:bvh.cpp

示例7: z_discontinuity

real FEdge::z_discontinuity() const
{
  if (!(getNature() & Nature::SILHOUETTE) && !(getNature() & Nature::BORDER)) {
    return 0;
  }

  BBox<Vec3r> box = ViewMap::getInstance()->getScene3dBBox();

  Vec3r bbox_size_vec(box.getMax() - box.getMin());
  real bboxsize = bbox_size_vec.norm();
  if (occludee_empty()) {
    // return FLT_MAX;
    return 1.0;
    // return bboxsize;
  }

#if 0
  real result;
  z_discontinuity_functor<SVertex> _functor;
  Evaluate<SVertex, z_discontinuity_functor<SVertex>>(&_functor, iCombination, result);
#endif
  Vec3r middle((_VertexB->point3d() - _VertexA->point3d()));
  middle /= 2;
  Vec3r disc_vec(middle - _occludeeIntersection);
  real res = disc_vec.norm() / bboxsize;

  return res;
  // return fabs((middle.z() - _occludeeIntersection.z()));
}
开发者ID:dfelinto,项目名称:blender,代码行数:29,代码来源:Silhouette.cpp

示例8: BWindow

/*******************************************************
*   Our wonderful BWindow, ya its kewl like that.
*   we dont do much here but set up the menubar and 
*   let the view take over.  We also nead some message
*   redirection and handling
*******************************************************/
ToolTipWindow::ToolTipWindow() : BWindow(BRect(0,0,100,19),"Tool Tip",
      B_NO_BORDER_WINDOW_LOOK,
      B_FLOATING_ALL_WINDOW_FEEL,
      B_ASYNCHRONOUS_CONTROLS|B_NOT_RESIZABLE|B_AVOID_FRONT|B_AVOID_FOCUS){
   
   Looper()->SetName(TOOL_TIP_WINDOW);
   
   BView *v = new BView(Bounds(),"",B_FOLLOW_ALL,0);
   v->SetViewColor(255,255,120);
   AddChild(v);
   
   BRect b = v->Bounds();
   b.Set(b.left-1,b.top-1,b.right+1,b.bottom+1);
   BBox *bb = new BBox(b,"",B_FOLLOW_ALL);
   v->AddChild(bb);
   
   b = bb->Frame();
   b.InsetBy(1,1);
   b.left = 4;
   b.bottom --;
   tipv = new BStringView(b,"","...",B_FOLLOW_ALL);
   tipv->SetAlignment(B_ALIGN_CENTER);
   bb->AddChild(tipv);
   
   Run();
}
开发者ID:BackupTheBerlios,项目名称:beae-svn,代码行数:32,代码来源:ToolTipWindow.cpp

示例9: BBox

VideoSettingsView::VideoSettingsView()
{
	BBox* defaultsBox = new BBox("defaults");
	defaultsBox->SetLabel(B_TRANSLATE("Defaults"));
	BGridView* defaultsGridView = new BGridView();

	BMenuField* inputMenuField = new BMenuField("inputMenuField",
		B_TRANSLATE("Video input:"), InputMenu());

	BMenuField* outputMenuField = new BMenuField("outputMenuField",
		B_TRANSLATE("Video output:"), OutputMenu());

	BLayoutBuilder::Grid<>(defaultsGridView)
		.SetInsets(B_USE_DEFAULT_SPACING, 0, B_USE_DEFAULT_SPACING,
			B_USE_DEFAULT_SPACING)
		.AddMenuField(inputMenuField, 0, 0)
		.AddMenuField(outputMenuField, 0, 1);

	defaultsBox->AddChild(defaultsGridView);

	BLayoutBuilder::Group<>(this)
		.SetInsets(0, 0, 0, 0)
		.Add(defaultsBox)
		.AddGroup(B_HORIZONTAL)
			.AddGlue()
			.Add(MakeRestartButton())
			.End()
		.AddGlue();
}
开发者ID:veer77,项目名称:Haiku-services-branch,代码行数:29,代码来源:MediaViews.cpp

示例10: setupTensor

void PMRoadGenerator::setupTensor(const Polygon2D& targetArea, const std::vector<std::pair<QVector2D, float>>& regular_elements, cv::Mat& tensor) {
	BBox bbox = targetArea.envelope();
	tensor = cv::Mat(bbox.dy() + 1, bbox.dx() + 1, CV_32F);

	for (int r = 0; r < tensor.rows; ++r) {
		for (int c = 0; c < tensor.cols; ++c) {
			int x = c + bbox.minPt.x();
			int y = r + bbox.minPt.y();

			double total_angle = 0.0;
			double total_weight = 0.0;
			for (int k = 0; k < regular_elements.size(); ++k) {
				float dist = (QVector2D(x, y) - regular_elements[k].first).length();

				double angle = regular_elements[k].second;
				double weight = exp(-dist / 10);
				total_angle += angle * weight;
				total_weight += weight;
			}

			float avg_angle = total_angle / total_weight;
			tensor.at<float>(r, c) = avg_angle;
		}
	}
}
开发者ID:gnishida,项目名称:SimpleCities,代码行数:25,代码来源:PMRoadGenerator.cpp

示例11: transformed

    inline BBox transformed ( const nv_math::mat4f &matrix, int dim=3)
    {
      int i;
      nv_math::vec4f box[16];
      // create box corners
      box[0] = nv_math::vec4f(min.x,min.y,min.z,min.w);
      box[1] = nv_math::vec4f(max.x,min.y,min.z,min.w);
      box[2] = nv_math::vec4f(min.x,max.y,min.z,min.w);
      box[3] = nv_math::vec4f(max.x,max.y,min.z,min.w);
      box[4] = nv_math::vec4f(min.x,min.y,max.z,min.w);
      box[5] = nv_math::vec4f(max.x,min.y,max.z,min.w);
      box[6] = nv_math::vec4f(min.x,max.y,max.z,min.w);
      box[7] = nv_math::vec4f(max.x,max.y,max.z,min.w);

      box[8] = nv_math::vec4f(min.x,min.y,min.z,max.w);
      box[9] = nv_math::vec4f(max.x,min.y,min.z,max.w);
      box[10] = nv_math::vec4f(min.x,max.y,min.z,max.w);
      box[11] = nv_math::vec4f(max.x,max.y,min.z,max.w);
      box[12] = nv_math::vec4f(min.x,min.y,max.z,max.w);
      box[13] = nv_math::vec4f(max.x,min.y,max.z,max.w);
      box[14] = nv_math::vec4f(min.x,max.y,max.z,max.w);
      box[15] = nv_math::vec4f(max.x,max.y,max.z,max.w);

      // transform box corners
      // and find new mins,maxs
      BBox bbox;

      for (i = 0; i < (1<<dim) ; i++){
        nv_math::vec4f point = matrix * box[i];
        bbox.merge(point);
      }

      return bbox;
    }
开发者ID:prabindh,项目名称:gl_cadscene_rendertechniques,代码行数:34,代码来源:cadscene.hpp

示例12: get_bbox

BBox Scene::get_bbox() {
  BBox bbox;
  for (SceneObject *obj : objects) {
    bbox.expand(obj->get_bbox());
  }
  return bbox;
}
开发者ID:Jerrypiglet,项目名称:cmu-15462-project-YuMao-RuiZhu,代码行数:7,代码来源:scene.cpp

示例13: SettingsView

MidiSettingsView::MidiSettingsView()
	:
	SettingsView()
{
	BBox* defaultsBox = new BBox("SoundFont");
	defaultsBox->SetLabel(B_TRANSLATE("SoundFont"));
	BGridView* defaultsGridView = new BGridView();

	fListView = new BListView(B_SINGLE_SELECTION_LIST);
	fListView->SetSelectionMessage(new BMessage(kSelectSoundFont));

	BScrollView *scrollView = new BScrollView("ScrollView", fListView,
			0, false, true);
	BLayoutBuilder::Grid<>(defaultsGridView)
		.SetInsets(B_USE_DEFAULT_SPACING, 0, B_USE_DEFAULT_SPACING,
				B_USE_DEFAULT_SPACING)
		.Add(scrollView, 0, 0);

	defaultsBox->AddChild(defaultsGridView);

	BLayoutBuilder::Group<>(this)
		.SetInsets(0, 0, 0, 0)
		.Add(defaultsBox)
		.AddGlue();
}
开发者ID:orangejua,项目名称:haiku,代码行数:25,代码来源:MidiSettingsView.cpp

示例14: assert

BBox SpherePrimitive::wsBounds(Geo::Geometry::CPtr geometry) const
{
  assert(geometry != NULL);
  assert(geometry->particles() != NULL);

  if (!geometry->particles()) {
    Log::warning("SpherePrimitive has no particles. "
                 "Skipping bounds generation.");
    return BBox();
  }

  BBox wsBBox;

  AttrVisitor visitor(geometry->particles()->pointAttrs(), m_params);
  Attr<V3f>   wsCenter("P");
  Attr<float> radius("radius");

  for (AttrVisitor::const_iterator i = visitor.begin(), end = visitor.end(); 
       i != end; ++i) {
    i.update(wsCenter);
    i.update(radius);
    wsBBox.extendBy(wsCenter.as<Vector>() + radius.as<Vector>());
    wsBBox.extendBy(wsCenter.as<Vector>() - radius.as<Vector>());
  }

  return wsBBox;
}
开发者ID:DocSavage,项目名称:pvr,代码行数:27,代码来源:SpherePrimitive.cpp

示例15: BView

PoorManAdvancedView::PoorManAdvancedView(const char* name)
    :
    BView(name, B_WILL_DRAW, NULL)
{
    PoorManWindow* win;
    win = ((PoorManApplication*)be_app)->GetPoorManWindow();

    BBox* connectionOptions = new BBox(B_TRANSLATE("Connections"));
    connectionOptions->SetLabel(STR_BBX_CONNECTION);

    fMaxConnections = new StatusSlider("Max Slider", STR_SLD_LABEL,
                                       STR_SLD_STATUS_LABEL,
                                       new BMessage(MSG_PREF_ADV_SLD_MAX_CONNECTION), 1, 200);

    // labels below the slider 1 and 200
    fMaxConnections->SetLimitLabels("1", "200");
    SetMaxSimutaneousConnections(win->MaxConnections());


    BGroupLayout* connectionOptionsLayout = new BGroupLayout(B_VERTICAL, 0);
    connectionOptions->SetLayout(connectionOptionsLayout);

    BLayoutBuilder::Group<>(this, B_VERTICAL)
    .AddGroup(connectionOptionsLayout)
    .SetInsets(B_USE_ITEM_INSETS)
    .AddStrut(B_USE_ITEM_SPACING)
    .Add(fMaxConnections)
    .End()
    .AddGlue()
    .SetInsets(B_USE_ITEM_INSETS);
}
开发者ID:yunxiaoxiao110,项目名称:haiku,代码行数:31,代码来源:PoorManAdvancedView.cpp


注:本文中的BBox类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。