Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6706033
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:28:21+00:00 2026-05-26T07:28:21+00:00

I have a created function file in hand which is to draw lines in

  • 0

I have a created function file in hand which is to draw lines in image,[img]=drawline(point1,point2,color,img). It’s used to connect any two points that are inside the image. I’m asked to create the voronoi diagram in image (not using plot function). For the moment, i’m trying to show the lines in image, but i don’t know how to get the vertices of the polygon edges.

I’ve been using some test codes:

x=[50 70 70 30 40 ];% this is just some simple values for testing, 
y=[50 30 90 30 80 ];% in further stage, i plan to use `x=rand(n,1)*200`.
img=zeros(200,200,3);
color=[255 0 0];
[vx,vy]=voronoi(x,y); 

I only know till above, next i think i need to use for loop to line the vertices up. just no idea how to start.And i’m also stuck in how to solve the negative and infinite issues, if i need to display them in image(pixels coordinates).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T07:28:22+00:00Added an answer on May 26, 2026 at 7:28 am

    Assuming you have this drawline function that draws lines in images, this is how you loop over the edges of Voronoi diagram of a set of points:

    %# set of points and voronoi diagram
    X = rand(10,1)*200; Y = rand(10,1)*200;
    [vx,vy] = voronoi(X,Y);
    
    %# vertices connecting the edges
    p1 = [vx(1,:);vy(1,:)];     % columns are "from" points
    p2 = [vx(2,:);vy(2,:)];     % columns are "to" points
    
    %# draw edges on top of image matrix
    img = zeros(200,200,3);
    clr = [255 0 0];
    for i=1:size(vx,2)
        img = drawline(p1(:,i), p2(:,i), clr, img);
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a JS function which executes fine when it's included an the
i am working on a web server and i have created a function which
I have created a function within my themes functions.php file in order to persist
i have created below function in a file info.php to debug variable & data
I have created a function that takes a SQL command and produces output that
I have created a function outside of $(document).ready() , but am still using jQuery
I have created a function in PHP that calls a webservice and parses through
in my data layer class I have created a function to manually refresh the
Hey, so I have created a function to check the DB for unique entries,
i have created a module with this among others this function in it: <?php

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.