Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
convex_hull.cpp File Reference

Go to the source code of this file.

Typedefs

typedef vector< unsigned > Hull
 

Functions

void randTest (unsigned n, valarray< double > &X, valarray< double > &Y)
 generates a random set of n points in X and Y.
 
void tworects (valarray< double > &X, valarray< double > &Y, Hull &expectedHull)
 generates a set of 8 points (actually the vertices of two rectangles) which lineup horizontally.
 
int drawCairo (const string &fname, const valarray< double > &X, const valarray< double > &Y, const Hull &hull)
 
int main (int argc, char **argv)
 
void dot (Cairo::RefPtr< Cairo::Context > &cr, double x, double y)
 
double xcoord (double x)
 
double ycoord (double y)
 

Variables

double width = 600
 
double height = 400
 
double border =10
 

Typedef Documentation

◆ Hull

typedef vector<unsigned> Hull

Definition at line 47 of file convex_hull.cpp.

Function Documentation

◆ dot()

◆ drawCairo()

int drawCairo ( const string &  fname,
const valarray< double > &  X,
const valarray< double > &  Y,
const Hull hull 
)

Definition at line 121 of file convex_hull.cpp.

References border, dot(), height, surface, width, xcoord(), and ycoord().

Referenced by main().

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 88 of file convex_hull.cpp.

References hull::convex(), drawCairo(), randTest(), and tworects().

◆ randTest()

void randTest ( unsigned  n,
valarray< double > &  X,
valarray< double > &  Y 
)

generates a random set of n points in X and Y.

Definition at line 51 of file convex_hull.cpp.

References getRand().

Referenced by main().

◆ tworects()

void tworects ( valarray< double > &  X,
valarray< double > &  Y,
Hull expectedHull 
)

generates a set of 8 points (actually the vertices of two rectangles) which lineup horizontally.

The expected hull are the lower-left and top-left corners of the left rectangle and the top-right/lower-right corners of the right rectangle.

Definition at line 66 of file convex_hull.cpp.

Referenced by main().

◆ xcoord()

double xcoord ( double  x)

Definition at line 115 of file convex_hull.cpp.

References border, and width.

Referenced by drawCairo().

◆ ycoord()

double ycoord ( double  y)

Definition at line 118 of file convex_hull.cpp.

References border, and height.

Referenced by drawCairo().

Variable Documentation

◆ border

◆ height

double height = 400

Definition at line 107 of file convex_hull.cpp.

Referenced by Inkscape::UI::Dialog::_add_items_with_images(), Inkscape::Extension::Internal::SvgBuilder::_createImage(), Inkscape::Extension::Internal::SvgBuilder::_createMask(), Inkscape::Extension::Internal::CairoRenderContext::_createPatternPainter(), Inkscape::DrawingImage::_pickItem(), Inkscape::CanvasItemGridTiles::_render(), Inkscape::UI::Toolbar::ToolbarWidget::_resize_handler(), Inkscape::UI::Toolbar::TextToolbar::_selectionChanged(), Inkscape::Extension::Internal::PdfImportDialog::_setPreviewPage(), add_actions_view_mode(), Inkscape::Extension::Internal::Wmf::add_bm16_image(), Inkscape::Extension::Internal::Wmf::add_dib_image(), Inkscape::Extension::Internal::Emf::add_image(), Inkscape::Extension::Internal::CairoRenderContext::addClippingRect(), Inkscape::Extension::Internal::SvgBuilder::addImage(), Inkscape::Extension::Internal::SvgBuilder::addImageMask(), Inkscape::Extension::Internal::SvgBuilder::addMaskedImage(), Inkscape::Extension::Internal::SvgBuilder::addSoftMaskedImage(), SPViewBox::apply_viewbox(), Inkscape::Extension::Internal::Bitmap::Crop::applyEffect(), Geom::GenericRect< C >::aspectRatio(), Inkscape::Drawing::averageColor(), Inkscape::calculate_font_weight(), Inkscape::Extension::Internal::calculatePreserveAspectRatio(), Inkscape::Extension::Internal::Wmf::common_bm16_to_image(), Inkscape::Extension::Internal::Wmf::common_dib_to_image(), Inkscape::Extension::Internal::Emf::common_image_extraction(), SPMeshNodeArray::create(), Inkscape::Extension::Internal::PrintEmf::create_brush(), Inkscape::Extension::Internal::PrintWmf::create_brush(), Inkscape::Extension::Internal::PrintEmf::create_pen(), Persp3D::create_xml_element(), Inkscape::Extension::Internal::CairoRenderContext::createSimilar(), InkFileExportCmd::do_export_png_now(), Inkscape::Colors::CMS::Transform::do_transform(), Inkscape::LivePathEffect::LPELattice::doEffect_pwd2(), Inkscape::LivePathEffect::LPELattice2::doEffect_pwd2(), PdfParser::doShowText(), Toy::draw(), LPEToy::draw(), draw_callback(), drawCairo(), Inkscape::Filters::FilterPrimitive::filter_primitive_area(), Inkscape::UI::Tools::fit_item(), Inkscape::Trace::gdkPixbufToGrayMap(), Inkscape::Trace::gdkPixbufToRgbMap(), OutputFile::generate(), cola::ConstrainedFDLayout::generateNonOverlapAndClusterCompoundConstraints(), Inkscape::Extension::Template::get_any_preset(), Inkscape::Extension::Internal::Filter::WaxBump::get_filter_text(), SPText::get_frame(), Inkscape::Extension::Template::get_preset(), Inkscape::Extension::Internal::TemplateBase::get_template_size(), cola::NonOverlapConstraints::getCurrSubConstraintAlternatives(), Inkscape::PageManager::getSizeLabel(), Inkscape::Trace::grayMapCanny(), Inkscape::Trace::grayMapGaussian(), init(), ink_cairo_surface_average_color_internal(), ink_cairo_surface_copy(), ink_cairo_surface_linear_to_srgb(), ink_cairo_surface_srgb_to_linear(), Inkscape::UI::Toolbar::SelectToolbar::layout_widget_update(), SPDesktopWidget::layoutWidgets(), main(), main(), Inkscape::Extension::TemplatePreset::match_size(), Inkscape::Extension::Internal::TemplateBase::match_template_size(), Inkscape::UI::Widget::InkSpinButton::measure_vfunc(), Inkscape::Extension::Internal::TemplateBase::new_from_template(), Inkscape::UI::NewFromTemplate::NewFromTemplate(), Inkscape::PageManager::newPage(), Inkscape::Extension::Internal::CairoRenderContext::nextPage(), Inkscape::UI::Toolbar::ToolbarWidget::on_size_allocate(), Inkscape::UI::View::SVGViewWidget::on_size_allocate(), Inkscape::UI::Dialog::DialogNotebook::on_size_allocate_scroll(), Inkscape::Extension::Internal::GdkpixbufInput::open(), Inkscape::Extension::Internal::PdfInput::open(), Inkscape::Extension::Internal::Svg::open(), OutputFile::openCairo(), Inkscape::LivePathEffect::MessageParam::param_set_min_height(), plot_bar(), plot_bar(), plot_bar(), Inkscape::Extension::Internal::CairoRenderContext::popLayer(), Inkscape::UI::popup_at(), cola::projectOntoCCs(), Inkscape::LivePathEffect::LPEPerspectiveEnvelope::projectPoint(), Inkscape::Text::Layout::queryCursorShape(), Avoid::Rectangle::Rectangle(), Inkscape::Filters::FilterTurbulence::render_cairo(), render_surface(), Inkscape::PageManager::resizePage(), Inkscape::PageManager::resizePage(), Inkscape::Trace::rgbMapGaussian(), Inkscape::Util::rounded_rectangle(), scale_free(), Inkscape::UI::Dialog::DialogNotebook::set_requested_height(), Inkscape::Filters::FilterPrimitive::set_subregion(), SPViewBox::set_viewBox(), Inkscape::Extension::Internal::SvgBuilder::setDocumentSize(), SPDocument::setHeight(), Inkscape::UI::View::SVGViewWidget::setResize(), Inkscape::Extension::Internal::CairoRenderer::setupDocument(), Inkscape::Extension::Internal::CairoRenderContext::setupSurface(), SPDocument::setWidthAndHeight(), InkviewWindow::show_document(), Inkscape::UI::Dialog::DialogNotebook::size_allocate_vfunc(), Inkscape::UI::Widget::InkSpinButton::size_allocate_vfunc(), Inkscape::UI::Widget::TabStrip::size_allocate_vfunc(), Inkscape::UI::Widget::TabsWidget::size_allocate_vfunc(), Inkscape::UI::Toolbar::PageToolbar::sizeChanged(), Inkscape::Extension::Internal::sp_asbitmap_render(), sp_export_png_file(), sp_export_png_file(), sp_file_convert_dpi(), Inkscape::UI::Tools::sp_flood_do_flood_fill(), sp_generate_internal_bitmap(), sp_gradient_reset_to_userspace(), sp_gradient_to_pixbuf(), sp_gradient_to_pixbuf_ref(), sp_gradstop_to_pixbuf_ref(), Inkscape::Extension::Internal::sp_image_render(), sp_png_write_rgba_striped(), Inkscape::Extension::Internal::sp_symbol_render(), sp_te_get_cursor_coords(), Inkscape::Extension::Internal::Metafile::toPNG(), Inkscape::Trace::Autotrace::AutotraceTracingEngine::trace(), SVGBox::update(), Inkscape::Extension::WidgetImage::WidgetImage(), write_image(), and ycoord().

◆ width

double width = 600

Definition at line 106 of file convex_hull.cpp.

Referenced by Inkscape::UI::Dialog::_add_items_with_images(), Inkscape::Extension::Internal::SvgBuilder::_createImage(), Inkscape::Extension::Internal::SvgBuilder::_createMask(), Inkscape::Extension::Internal::CairoRenderContext::_createPatternPainter(), Inkscape::UI::Tools::EraserTool::_fitAndSplit(), Inkscape::UI::Widget::_getMargin(), Inkscape::UI::Tools::EraserTool::_handleKeypress(), Inkscape::UI::Widget::ColorWheelHSL::_is_in_ring(), Inkscape::DrawingImage::_pickItem(), Inkscape::DrawingShape::_pickItem(), Inkscape::CanvasItemGridTiles::_render(), Inkscape::UI::Toolbar::ToolbarWidget::_resize_handler(), Inkscape::UI::Widget::ColorWheelHSLuv::_set_from_xy(), Inkscape::UI::Widget::ColorWheelHSL::_set_from_xy(), Inkscape::Extension::Internal::PdfImportDialog::_setPreviewPage(), Inkscape::CanvasItemCtrl::_update(), Inkscape::UI::Widget::ColorWheelHSL::_update_ring_color(), Inkscape::UI::Widget::OKWheel::_updateDimensions(), Inkscape::DrawingGlyphs::_updateItem(), add_actions_view_mode(), Inkscape::Extension::Internal::Wmf::add_bm16_image(), Inkscape::Extension::Internal::Wmf::add_dib_image(), Inkscape::Extension::Internal::Emf::add_image(), Inkscape::UI::Dialog::add_shadow(), Inkscape::Extension::Internal::CairoRenderContext::addClippingRect(), Inkscape::DrawingText::addComponent(), Inkscape::Extension::Internal::SvgBuilder::addImage(), Inkscape::Extension::Internal::SvgBuilder::addImageMask(), Inkscape::Extension::Internal::SvgBuilder::addMaskedImage(), Inkscape::Extension::Internal::SvgBuilder::addSoftMaskedImage(), Inkscape::UI::Toolbar::TextToolbar::align_mode_changed(), Inkscape::Text::Layout::appendControlCode(), SPViewBox::apply_viewbox(), Inkscape::Extension::Internal::Bitmap::Crop::applyEffect(), Inkscape::UI::Dialog::Transformation::applyPageSkew(), Inkscape::UI::Dialog::SingleExport::areaXChange(), Inkscape::UI::Dialog::GridArrangeTab::arrange(), Geom::GenericRect< C >::aspectRatio(), Inkscape::UI::Widget::PopoverMenu::attach(), Inkscape::Drawing::averageColor(), Inkscape::CanvasItemCtrl::build_cache(), cairo_d2_sb2d(), cairo_sb2d(), Inkscape::calculate_font_weight(), Inkscape::Extension::Internal::calculatePreserveAspectRatio(), Inkscape::Extension::Internal::Wmf::common_bm16_to_image(), Inkscape::Extension::Internal::Wmf::common_dib_to_image(), Inkscape::Extension::Internal::Emf::common_image_extraction(), compose(), Geom::Piecewise< T >::compose(), SPMeshNodeArray::create(), Inkscape::Extension::Internal::PrintEmf::create_brush(), Inkscape::Extension::Internal::PrintWmf::create_brush(), Inkscape::UI::Widget::create_color_plate(), Inkscape::UI::Widget::create_color_preview(), Inkscape::UI::Widget::create_color_wheel(), Inkscape::Extension::Internal::PrintEmf::create_pen(), SPGradient::create_preview_pattern(), Inkscape::UI::Widget::create_separator(), Persp3D::create_xml_element(), Inkscape::Extension::Internal::CairoRenderContext::createSimilar(), Inkscape::UI::Dialog::DialogWindow::DialogWindow(), Inkscape::UI::Dialog::dm_get_window_position(), InkFileExportCmd::do_export_png_now(), Inkscape::Colors::CMS::Transform::do_transform(), Inkscape::LivePathEffect::LPEKnot::doEffect_path(), Inkscape::LivePathEffect::LPELattice::doEffect_pwd2(), Inkscape::LivePathEffect::LPELattice2::doEffect_pwd2(), Inkscape::LivePathEffect::LPEJoinType::doOnApply(), Inkscape::LivePathEffect::LPEPowerStroke::doOnApply(), Inkscape::LivePathEffect::LPETaperStroke::doOnApply(), PdfParser::doShowText(), Inkscape::UI::Dialog::SingleExport::dpiChange(), Toy::draw(), LPEToy::draw(), draw_callback(), Inkscape::UI::Widget::draw_circle(), Inkscape::UI::Dialog::ColorItem::draw_color(), Inkscape::UI::Widget::ColorPreview::draw_func(), Inkscape::UI::Widget::ColorSlider::draw_func(), Inkscape::UI::Widget::GradientImage::draw_func(), Inkscape::UI::Widget::PageSizePreview::draw_func(), Inkscape::UI::Widget::ColorPalettePreview::draw_func(), Inkscape::UI::Widget::DashSelector::draw_pattern(), Inkscape::UI::Widget::Ruler::draw_scale(), drawCairo(), Inkscape::Text::Layout::dumpAsText(), Inkscape::Extension::Internal::BlurEdge::effect(), Inkscape::UI::Dialog::Export::exportRaster(), Inkscape::Filters::FilterPrimitive::filter_primitive_area(), Inkscape::LivePathEffect::findShadowedTime(), Inkscape::UI::Tools::fit_item(), Inkscape::Trace::gdkPixbufToGrayMap(), Inkscape::Trace::gdkPixbufToRgbMap(), OutputFile::generate(), generateLevels(), cola::ConstrainedFDLayout::generateNonOverlapAndClusterCompoundConstraints(), Inkscape::UI::Widget::get_active_area(), Inkscape::Extension::Template::get_any_preset(), Inkscape::Extension::Internal::Filter::Crosssmooth::get_filter_text(), Inkscape::Extension::Internal::Filter::NeonDraw::get_filter_text(), SPText::get_frame(), Inkscape::UI::Widget::GradientWithStops::get_layout(), SPShape::get_markers(), Inkscape::Extension::Template::get_preset(), Inkscape::UI::Widget::ColorWheelHSL::get_radii(), Inkscape::Extension::Internal::TemplateBase::get_template_size(), Inkscape::CanvasItemCtrl::get_total_width(), Inkscape::UI::Tools::get_trace_pixel(), Inkscape::UI::Dialog::CloneTiler::get_transform(), Inkscape::UI::Widget::ColorWheelHSL::get_triangle_corners(), cola::NonOverlapConstraints::getCurrSubConstraintAlternatives(), Inkscape::PageManager::getSizeLabel(), Inkscape::Trace::grayMapCanny(), Inkscape::Trace::grayMapGaussian(), Inkscape::half_outline(), init(), ink_cairo_pattern_create_slanting_stripes(), ink_cairo_surface_average_color_internal(), ink_cairo_surface_copy(), ink_cairo_surface_linear_to_srgb(), ink_cairo_surface_srgb_to_linear(), Path::InsideOutline(), Tracer::integral(), Inkscape::UI::Toolbar::SelectToolbar::layout_widget_update(), SPDesktopWidget::layoutWidgets(), Inkscape::load_cached_font_info(), Inkscape::UI::Dialog::DialogContainer::load_container_state(), Inkscape::LivePathEffect::lpe_shape_revert_stroke_and_fill(), main(), main(), Inkscape::UI::Widget::MarkerComboBox::MarkerComboBox(), Inkscape::Extension::TemplatePreset::match_size(), Inkscape::Extension::Internal::TemplateBase::match_template_size(), Inkscape::Extension::Internal::TemplateBase::new_from_template(), Inkscape::UI::NewFromTemplate::NewFromTemplate(), Inkscape::PageManager::newPage(), Inkscape::Extension::Internal::CairoRenderContext::nextPage(), Inkscape::UI::Dialog::ObjectsPanel::ObjectsPanel(), Inkscape::UI::Dialog::DialogMultipaned::on_drag_update(), Inkscape::UI::Widget::ColorWheelHSL::on_drawing_area_draw(), Inkscape::UI::Widget::ColorWheelHSL::on_drawing_area_size(), Inkscape::UI::Widget::Bin::on_size_allocate(), Inkscape::UI::Toolbar::ToolbarWidget::on_size_allocate(), Inkscape::UI::View::SVGViewWidget::on_size_allocate(), Inkscape::UI::Dialog::BatchExport::onExport(), Inkscape::UI::Dialog::SingleExport::onExport(), Inkscape::Extension::Internal::GdkpixbufInput::open(), Inkscape::Extension::Internal::PdfInput::open(), Inkscape::Extension::Internal::Svg::open(), OutputFile::openCairo(), Inkscape::outline(), Path::Outline(), Inkscape::outline_join(), Path::OutsideOutline(), Inkscape::UI::Dialog::overlayPixels(), Inkscape::LivePathEffect::path_from_piecewise_fix_cusps(), Inkscape::Extension::Internal::CairoRenderContext::popLayer(), Inkscape::UI::popup_at(), cola::projectOntoCCs(), Inkscape::LivePathEffect::LPEPerspectiveEnvelope::projectPoint(), Inkscape::CanvasItemGuideHandle::radius(), cola::ConstrainedFDLayout::recGenerateClusterVariablesAndConstraints(), Inkscape::Extension::Internal::PrintMetafile::rect_cutter(), Avoid::Rectangle::Rectangle(), Inkscape::Filters::FilterTurbulence::render_cairo(), render_surface(), Inkscape::UI::Widget::ColorPalette::resize(), Inkscape::PageManager::resizePage(), Inkscape::PageManager::resizePage(), Inkscape::Trace::rgbMapGaussian(), Inkscape::UI::Widget::round_rect(), Inkscape::Util::rounded_rectangle(), Inkscape::UI::Dialog::DialogContainer::save_container_state(), Inkscape::save_font_cache(), scale_free(), Inkscape::Extension::Internal::Wmf::select_pen(), Inkscape::UI::Dialog::set_document_dimensions(), Inkscape::UI::Widget::GradientSelector::set_gradient_size(), Inkscape::CanvasItem::set_outline_width(), Inkscape::UI::Widget::PageSizePreview::set_page_size(), Inkscape::UI::Widget::GradientVectorSelector::set_pixmap_size(), Inkscape::UI::Dialog::DialogMultipaned::set_restored_width(), Inkscape::CanvasItemRect::set_shadow(), Inkscape::CanvasItem::set_stroke_width(), Inkscape::Filters::FilterPrimitive::set_subregion(), Inkscape::UI::Widget::ColorPalette::set_up_scrolling(), SPViewBox::set_viewBox(), Inkscape::UI::Dialog::DocumentProperties::set_viewbox_size(), Inkscape::CanvasItemCurve::set_width(), Inkscape::Extension::Internal::SvgBuilder::setDocumentSize(), Inkscape::UI::View::SVGViewWidget::setResize(), Inkscape::UI::Widget::StrokeStyle::setStrokeWidth(), Inkscape::UI::Dialog::Print::setup_page(), Inkscape::Extension::Internal::CairoRenderer::setupDocument(), Inkscape::Extension::Internal::CairoRenderContext::setupSurface(), SPDocument::setWidth(), SPDocument::setWidthAndHeight(), Inkscape::UI::Toolbar::PencilToolbar::shapewidth_value_changed(), InkviewWindow::show_document(), Inkscape::UI::Dialog::DialogMultipaned::size_allocate_vfunc(), Inkscape::UI::Dialog::DialogNotebook::size_allocate_vfunc(), Inkscape::UI::Widget::Canvas::size_allocate_vfunc(), Inkscape::UI::Dialog::ColorItem::size_allocate_vfunc(), Inkscape::UI::Widget::Bin::size_allocate_vfunc(), Inkscape::UI::Widget::CanvasGrid::size_allocate_vfunc(), Inkscape::UI::Widget::InkSpinButton::size_allocate_vfunc(), Inkscape::UI::Widget::TabStrip::size_allocate_vfunc(), Inkscape::UI::Widget::TabsWidget::size_allocate_vfunc(), Inkscape::UI::Toolbar::PageToolbar::sizeChanged(), Inkscape::Extension::Internal::sp_asbitmap_render(), sp_export_png_file(), sp_export_png_file(), sp_file_convert_dpi(), Inkscape::UI::Tools::sp_flood_do_flood_fill(), sp_generate_internal_bitmap(), sp_gradient_draw(), sp_gradient_reset_to_userspace(), sp_gradient_to_pixbuf(), sp_gradient_to_pixbuf_ref(), sp_gradstop_to_pixbuf_ref(), Inkscape::UI::Dialog::sp_icon_doc_icon(), Inkscape::Extension::Internal::sp_image_render(), sp_png_write_rgba_striped(), Inkscape::Extension::Internal::sp_symbol_render(), Inkscape::UI::Widget::spw_hbox(), Inkscape::UI::Dialog::AttrDialog::startValueEdit(), Path::Stroke(), stroke_average_width(), Inkscape::Extension::Internal::Metafile::toPNG(), Inkscape::UI::Dialog::FilterEffectsDialog::PrimitiveList::update(), SVGBox::update(), Inkscape::UI::Widget::ImageProperties::update(), Inkscape::UI::Widget::ColorWheelHSL::update_ring_source(), Inkscape::UI::Widget::ColorWheelHSL::update_triangle_source(), Inkscape::UI::Toolbar::PencilToolbar::update_width_value(), Inkscape::UI::Dialog::DialogWindow::update_window_size_to_fit_children(), Inkscape::Extension::WidgetImage::WidgetImage(), write_image(), xcoord(), and Inkscape::UI::Dialog::XmlTree::XmlTree().