Building multiple arrays from a read textfile - arrays

I am trying to build multiple arrays from a read textfile. The read text file comes out as a long column of numbers, and I am trying to split them in groups of three, building arrays until I am done running through the numbers. Here is the block diagram. I know you need a for loop to do this, but figuring out a way to utilize it is giving me lots of trouble.

You need the Reshape Array primitive. See image.
The attached image is a PNG VI snippet. Drag it out of your browser onto a block diagram to instantiate the code directly. This snippet works with LV 2015 and earlier (as noted in the image in the upper right corner). You can create snippets for future posts by selecting code on the block diagram and choosing "Edit >> Create VI Snippet From Selection".

Related

Read bytes of interlaced PNG in C

Ive been trying to make my own PNG reader in C and ive gotten to the point where it works normally but I want to try and expand its support. I noticed that while uncommon, interlaced png's do exist. Now, I want the goal of my reader simply to return an array of rgba values cooresponding to each pixel in top left to bottom right order. I would not be creating or displaying any pngs.
based on what i saw on the wikipedia for Adam7 Interlacing (the type pngs use) i would most have to add support for it by organizing the final array according to Adam7. However, when I reviewed the Interlacing and Progressive Display section of libpng (one of the sources i was using), it stated:
Note that, although I've described the method in terms of 8 × 8 tiles, pixels for any given pass are stored as complete rows, not as tiled groups. For example, the fifth pass consists of every other pixel in the entire third row of the image, followed by every other pixel in the seventh row, and so on.
This makes it seem as though the interlacing is meat for the program in which displays it to use, rather than the information itself being stored using the Adam7 Algorithm.
My question now is, If im not displaying the png, does interlacing matter? And if so, could someone provide an example of how to uninterlace the information? Because this aspect still confuses me.

Overlaying 2 or more shapes in a bitmap file created in C?

i was working on a program that will, depending on the input draw, shapes of different colors onto a bitmap file, it works fine if i just have to draw one shape, but if i for example take two or more shapes it just draws over the old picture and the old one gets lost but i need them to overlay to create more complex pictures. Is there a way when i am writing to a bitmap file to skip over parts i dont want to write over ? I also tryed making an array in which i would save all the pixel data, but that doesnt work if i take a bitmap of a size larger than 800x800, depending on the size of the type of the elements of the array. I am open for any suggestion and comment. Thank you in advance.
You need to draw the second shape using a transparent background, how you would do that is entirely up to you as you don't provide any information about what technology you are using.

WPF 3D and Helix 3D toolkit graphics with ~500,000 triangles in one viewport- optimizing

I am new to stack overflow and new to 3D graphics programming. I have been given the task of creating an app that will read in data (currently I am reading from a delimited text file, but eventually will read from data arrays) and to graphically display the data in 3D. The data is x,y,z coordinates read from a 3D scanner which is scanning logs. I need to show the 3D representation of these logs on screen, from 4 different angles. I am reading the data into a 2-dimensional Point3D array and then using it to create 3D models in a HelixViewport3D. I use a nested for loop to check that the data points in the array are within certain x,Z bounds- and if they are I need to create a triangle out of that data. Once the entire array is passed through, I add the Model3DGroup to the children of my viewport:
topModel.Content = topGroup;
this.mainViewport.Children.Add(topModel);
It takes about 8 seconds for this to take place and zooming,panning, rotating are very very slow with all this data on the screen (around 500,000 triangles). Are there any ways to improve performance of WPF 3D graphics? I actually don't need to be able to zoom/pan/rotate in the finished app but it is helpful for debugging. The final app will simply be the same model shown statically 4 different ways, from different sides. However, I need to be able to read in the data and get the graphics to display in 1-5 seconds. Any help is greatly appreciated, and I hope my question is fairly clear!
EDIT: After doing some more digging into vertex buffering, this is what I need to do. I am using way too many points. If anyone can point me to some literature on doing vertex/index buffering in c#, it would be greatly appreciated!
I have solved this issue. Thanks for the input Capt Skyhawk! You saying that you doubted this was a WPF3D shortcoming helped me look in the right places. My problem was that the way I wrote this made every triangle it's own ModelVisual3D!! I re-wrote the code to contain only 3 GeometryModel3D (sp?) objects, and all the triangles are placed in a MeshGeometry3D and then the mesh is used to create a model. This made the models render in < 0.1 seconds. I now have a new issue- for some reason only about half of the triangles are showing up in the model in my viewports. I'm not sure why, though it may be that I have too many Point3D points or too many triangle indices in my mesh.
I doubt this is a shortcoming in WPF3D. It's more than likely the loading process. Parsing a text file with 500,000 triangles(even more points!) is where the bulk of the processing time is being spent.
If the loading of the text file is not being included in the 8 seconds, something is very wrong.
Are you using index buffers? If not, you're shooting yourself in the foot with that many vertices.

Intersected, buffered polygon - ArcGIS API for Silverlight

I am using Silverlight (4) to create an application in (VS 2010). I utilized the ArcGIS API’s for Silverlight to generate the following scenario:
I buffered a polyline to a variable distance.
I then retrieve all but only those polygons that are overlapped by the buffer.
I then intersect the overlapped portions to separate them.
Attaining the separated overlapped portions, I was about to utilize the Area and perimeter service to retrieve the areas of the portions, but realized that this last step would be in the wind.
I have no problem coding the above scenario except; I now realize that step 4 would not be very useful at this point, since I have no way of sharing data between the separated overlapped portions to the original polygons. Imagine if you will; before I separated the overlapped portions from the polygons, they had data tied to them; such as valuationNumber and volume, but after the separation due to the intersection service, the separated portions seems blank with no data. My goal is to have a list highlighting the valuationNumber, volume, and the area of the separated portion.
Something like:
Valuation:
12345678
Volume:
1234/123
Area of Separation (M):
12
Any, and I mean any help would be appreciated.
[copied and pasted my comments from above due to laziness]
Well then, I would suppose I created a work around, I wonder if there is a right way out there though. Anyhow, I did the following: I created a Dictionary Object and populated it with the Attribute values of the original polygon just as they are created. Then, just as the overlapped portions are being created I assigned the attribute values from my Dictionary. So, now the values match up, and all binding works just fine. But hey, if anyone know a better way; I'm all eyes.
In fact, to make matters seem a bit better, I made an improvement on the work around. I create a class with the fields I wanted to be in both original and separated portions. Then added this class as the value parameter of my dictionary object I spoke of earlier, then followed the same procedure. Now I have all the fields being mapped to in XAML working nicely (for now).

how can i auto-generate sets of 3 colors (border, fill & text) that go together

I am trying to automatically generate a bunch of images all
containing a border, a fill and a text label within.
I am using a script to generate a svg file that I subsequently rasterize using batik
I'm looking for either
an algorithm to generate distinct color sets that go together
or a pre-canned set of colors that someone has put together
Pointers appreciated
I have used this online colour scheme generator for "quick fixes".
http://www.colorschemer.com/online.html
I came across sassafras that provides a good building block
https://github.com/teejayvanslyke/sassafras
and it references
http://www.tigercolor.com/color-lab/color-theory/color-theory-intro.htm
to help with color theory

Resources