Bounded Area

Hi, I am trying to create a bounded area using two separate sets of points. One set will create the upper bound and the other will create the lower bound. I am new to MATLAB so am lost. Does anyone have any suggestions?

6 Comments

Sean de Wolski
Sean de Wolski on 21 Feb 2012
please provide some (small!) sample data, the operation you wish to complete, and the expected results.
Kylie
Kylie on 21 Feb 2012
center point at [0,0,0]
boundary coordinates: [0,150,0] [150,0,0] [0,-150,0] [-150,0,0]
random coordinates: [10,15,2] [50,60,10] [45,87,9]
My objective is to use the minimum distance from the center point to the boundary coordinates and use that as my upper bound. Then the maximum distance from the center point to the random coordinates and use that as my lower bound. Then I wish to see if a particular pressure will expand a distance that is in the bounded area.
Sean de Wolski
Sean de Wolski on 21 Feb 2012
sounds like youmight want convhull(). What do you mean by "expand a distance that is in the bounded area"? Does that mean "be a vertex of the convex hull"?
Kylie
Kylie on 21 Feb 2012
I'm not sure what a convex hole is. Basically I just need to identify a bounded area and identify the distance away from the center that will be in the bounded area.
the cyclist
the cyclist on 21 Feb 2012
Kylie, have you tried running the convex hull (not convex "hole") code that I put in my solution? That illustrates the concept. It is essentially the "bounded area" that you are talking about. A more technical definition is here: http://mathworld.wolfram.com/ConvexHull.html
Kylie
Kylie on 22 Feb 2012
I will try explaining my problem again..I don't think I was very clear yesterday. I don't think the convex hull is what I am looking for.
I have a center point and I have two data sets surrounding the center point. My ultimate goal is to create two circles..one using the first data set (smaller radius) and one using the second data set (larger radius). The area inbetween the two circles is the area I am interested in. The distance from the center point to the area inbetween the two radii is what I am interested in.
The first data set consists of about 10 points that are close to the center point. I would like to input these points and then be able to use the furthest point from the center in this set to use as my minimum radius for the bounded area.
The second data set consists of about 4 points that are farther away from the center point (these create my boundaries for the experiment). I would like to input these points and then be able to use the closest point from the center in this set to use as my maximum radius for the bounded area.

Sign in to comment.

Answers (2)

the cyclist
the cyclist on 21 Feb 2012
Please do follow the suggestion in Sean's comment. But taking a guess here, I think the convhull() function might be useful for what you are trying to do. Here is an example from the help file:
x = rand(20,1);
y = rand(20,1);
figure
hold on
plot(x,y, '.');
k = convhull(x,y);
plot(x(k), y(k), '-r')
hold off
Image Analyst
Image Analyst on 22 Feb 2012
I'm not sure what "upper" and "lower" refer to but maybe she's wanting to combine two areas, and not necessarily in a convex hull manner. Maybe she just want to OR two binary regions together using poly2mask(), as in this code:
clc; % Clear the command window.
workspace; % Make sure the workspace panel is showing.
fontSize = 20;
b = zeros(500, 'uint8');
subplot(2,2,1);
imshow(b);
axis on;
title('Draw a polygon', 'FontSize', fontSize);
% Enlarge figure to full screen.
set(gcf, 'units','normalized','outerposition',[0 0 1 1]); % Maximize figure.
message = sprintf('Draw the first polygon with left clicks.\nRight click on the final vertex to finish it');
uiwait(msgbox(message));
% Draw the first polygon.
bw1 = roipolyold();
imshow(bw1);
axis on;
title('First polygon', 'FontSize', fontSize);
message = sprintf('Draw the second polygon with left clicks.\nRight click on the final vertex to finish it');
uiwait(msgbox(message));
% Draw the second polygon.
bw2 = roipolyold();
subplot(2,2,2);
imshow(bw2);
axis on;
title('Second polygon', 'FontSize', fontSize);
% Combine them with OR.
both = bw1|bw2;
subplot(2,3,5);
imshow(both);
axis on;
title('Both polygons', 'FontSize', fontSize);

1 Comment

Kylie
Kylie on 22 Feb 2012
please see above revised explanation of problem

Sign in to comment.

Categories

Find more on Computational Geometry in Help Center and File Exchange

Asked:

on 21 Feb 2012

Edited:

on 20 Oct 2013

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!