Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

sheshu9a1

Member

12-18-2021 02:52 AM

Options

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report to a Moderator

altenbach

Knight of NI

12-18-2021 09:55 AM - edited 12-18-2021 10:22 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report to a Moderator

We discussed all this a month ago and you are still doing this way too complicated* and backwards. The calculation should be pixel based and not ray based. Have you studied my earlier advice? Is there anything you don't understand?

Your question is not clear at all. Which "empty places" do you want to fill (everything currently black? just between the five lines?)

*notes

- Why is the diagram maximized to the screen?
- You have a case structure where both cases have identical code, adding zero. What's the point? A simple orange wire would the the same thing!
- You have a big case structure with five cases, each with mostly identical code, differing only by a diagram constant. Only the diagram constant belongs inside the case structure! The rest can be shared outside the case!
- Why do you think you need to calculate cos of exactly the same value 2048 times? Why calculate sin(32*pi/180) 5x2048 times?!?!? Once is enough!

12-19-2021 10:13 PM - edited 12-19-2021 10:19 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report to a Moderator

wiebe@CARYA

Knight of NI

12-20-2021 10:02 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report to a Moderator

@sheshu9a1 wrote:

I tried to understand your old code but couldn't get it why you have taken complex numbers.

Complex numbers are just a convenient container for x,y data... You get a lot of vector math for free.

LabVIEW Programming ((make LV more popular, read this)

altenbach

Knight of NI

12-20-2021 12:00 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report to a Moderator

@sheshu9a1 wrote:

I have modified the code and reduced the redundancy.

You are lucky that the LabVIEW compiler is smart an does a constant folding on the cos calculation in your inner loop. This does NOT belong in the inner loop because it is loop invariant. Right?

Here's how I would have simplified your earlier code instead. Don't rely on the compiler to clean up your redundancies! *(note that this is a literal rewrite, leaving all your weird calculations in place. I am sure there are fundamentally better ways to approach this)*

@sheshu9a1 wrote:

I just want to fill between the "five lines" rest of the graph stays black. What do you mean by the calculation must be pixel based but not on ray based?

Your intensity graph is a 2D array and only has a 295x456 area, so unless you want to zoom in later, that all you need in terms of array size. You are replacing data along arbitrary lines (ray based) and that means that sometimes you hit the same element multiple times or skip one once in a while. OTOH, you can calculate from simple geometry exactly what value each 2D array element should have. It is much more reasonable to iterate over all array elements, preferably using interpolation as in my earlier example.

@sheshu9a1 wrote:

I tried to understand your old code but couldn't get it why you have taken complex numbers.

Complex numbers are just a convenient way to represent point in a 2D plane and do calculations in 2D. It would take 5 minutes to learn and would immediately simplify all your 2D trigonometry. **Complex does not add complexity, it simplifies!** Nobody forces you to use complex, you can do exactly the same using simple numbers and some high-school trigonometry. Your choice!!

If you did not understand my solution, you need to __simply ask for clarification!__ It is not efficient to come back after a month still stuck in the same rut and start a new thread!

Now go back to the old thread, study my last solution, try to understand every detail, and __ask specific questions__ where things are not clear. Good luck!

The entire problem does not make a lot of sense to me anyway. Each ray has the same values, so graphing it at multiple angles seems completely redundant. The full data could just be displayed in a simple waveform graph, right? An intensity graph would be useful if the data depends on direction, for example

12-20-2021 10:21 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report to a Moderator

Actually the data does change along with the angles.

wiebe@CARYA

Knight of NI

12-21-2021 03:57 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report to a Moderator

You'd also need to specify how you want to interpolate the values.

As far as we've been told (by you) you have 'lines' with 'values'. Theoretically, these lines have an infinite number of points, although you display just a few in the graph

You can't just 'interpolate between lines'. You could interpolate between horizontal lines in the graph, or vertical, that's relatively easy. Interpolation between the closest point of several lines is a lot harder. This would start to look like polygon rendering. Then you have algorithms like Inverse Distance Weighting, but that isn't really suitable for lines either. The way you want to interpolate could lead to completely different approaches.

It would help us help you if you could specify very, *very*, clearly what you want. You could for instance show us what you want the result to look like, even if it's created in paint, 3DS, matlab or on a napkin.

LabVIEW Programming ((make LV more popular, read this)

12-21-2021 04:06 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report to a Moderator

wiebe@CARYA

Knight of NI

12-21-2021 05:28 AM - edited 12-21-2021 05:31 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report to a Moderator

@sheshu9a1 wrote:

So... Why not post this code and tell us where do you need help?

It seems you can already do what you're asking for?

Can you post this actual data set? It seems what you posted is only a small part of the data, so it will never look like this. Could be wrong...

LabVIEW Programming ((make LV more popular, read this)

12-21-2021 06:28 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report to a Moderator