From 11:00 PM CDT Friday, Nov 8 - 2:30 PM CDT Saturday, Nov 9, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Extend shape in graph

Solved!
Go to solution

I am working with 1 array. That array will create a shape and I display it in 1 graph. I want extend shape according to a range that you have set up. The file below is the code I tried to do.

Please help me solve this problem. ThankMy desired shape is the outsideMy desired shape is the outside

0 Kudos
Message 1 of 11
(3,400 Views)

This isn't really a LabVIEW problem.  This is a math/geometry problem.

 

How would you solve the problem numerically if you were doing this on pencil and paper?

0 Kudos
Message 2 of 11
(3,380 Views)
Solution
Accepted by topic author Vu_Anh

just an idea:

simple_scale.PNG

Message 3 of 11
(3,334 Views)

It is also what I mean. But i want its output to also be an array (shown on the graph) with a larger size. I want the distance from each side to be equal. can you help me

0 Kudos
Message 4 of 11
(3,317 Views)

image.png

This is how I deal on paper. "a" is the value you want to set the width is how much? but I don't know how to handle an array with lots of values ​​in it and when when it is a polygon

0 Kudos
Message 5 of 11
(3,310 Views)

Array with lots of values, you handle with a loop.

 

Your hand sketch is too simple as it only shows a rectangle that is parallel to the axes.  Your code shows something with a triangular shape.  I assume you want an angled side to also be offset by ""a"?  In which case you can't just add "a" to the x and y coordinates.

 

As I said, this is a math problem, and you have worked out the math yet.  Have you googled this yet?  https://stackoverflow.com/questions/1109536/an-algorithm-for-inflating-deflating-offsetting-bufferin...

 

I think for each "side", you want to find the vector that is normal to that side (and you have to know whether which direction that vector is pointing, probably knowing what point is inside the shape), and adding a cos theta  to the x coordinates, and a sin theta to the y coordinates of the two points that define that side where theta is the angle of that vector relative to the X axis.

 

Once you do that for all sides, then you'll find out you'll have an exploded version of your original shape, but none of the points match.  You'll have to go through the points again and create new endpoints based on where the adjacent sides would intersect.

 

Solve this on paper in a flow chart.  Then it will be easy to transfer to LabVIEW code!

Message 6 of 11
(3,297 Views)

@Vu_Anh wrote:

 

This is how I deal on paper. "a" is the value you want to set the width is how much? but I don't know how to handle an array with lots of values ​​in it and when when it is a polygon


You need to be careful, because even if the spacing of the parallel segments is "a", the distance of the corner point pairs might be srqt(2)*a, so you need to decide who is supposed to "win". In the more general case, you also need to deal with segments that are convex or at arbitrary angles and local curvatures.

 

What precision do you need? For example are you trying to find the walls generated if you move a mill bit of a given diameter (a) along the original path? Something else?

Message 7 of 11
(3,278 Views)

yeah. i am trying to find the walls generated if you move a mill bit of a given diameter (a) along the original path and i want its output to also be an array (shown on the graph) with size "a + original path"

0 Kudos
Message 8 of 11
(3,252 Views)

@RavensFan wrote:

As I said, this is a math problem, and you have worked out the math yet.  Have you googled this yet?  https://stackoverflow.com/questions/1109536/an-algorithm-for-inflating-deflating-offsetting-bufferin...

 

kudos for this hyperlink!

0 Kudos
Message 9 of 11
(3,215 Views)

I can do it your way. thank you very much. Heart

0 Kudos
Message 10 of 11
(3,198 Views)