2d

2d Array from text file c# [closed]

本秂侑毒 提交于 2019-11-28 08:51:15
I have a text file that looks like this 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 in a 10 x 10 grid. using c# I need to take the text file and turn it into a 2d array of integers so that I can manipulate the integers on an independent level. Please help cant work it out, String input = File.ReadAllText( @"c:\myfile.txt" ); int i = 0, j = 0; int[,]

Mapping coordinates from plane given by normal vector to XY plane

谁说我不能喝 提交于 2019-11-28 08:49:42
So, I have this algorithm to calculate cross-section of 3D shape with plane given with normal vector. However, my current problem is, that the cross-section is set of 3D points (all lying on that given plane) and to display it I need to map this coordinates to XY plane. This works perfect if the plane normal is something like (0,0,c) - I just copy x and y coordinates discarding z. And here is my question: Since I have no idea how to convert any other plain could anybody give me any hint as to what should I do now? Your pane is defined by a normal vector n=(xn,yn,zn) For coordination

Render filled complex polygons with large number of vertices with OpenGL

ぃ、小莉子 提交于 2019-11-28 06:57:40
问题 I use OpenGL to render 2D map and in the process I need to render filled polygons with large number of vertices( 100,000+ ). To do this, I tessellated the polygons to triangles using glu tessellator and rendered the triangles with VBO. The polygons are rendered successfully. The problem is that the tessellation process turns out to be extremely slow. For some charts with 500,000 vertices, it will take nearly 2 mins on my laptop(i5-3230M 2.6GHz, 8G RAM). This is unacceptable for my application

Drawing a Line - Maximum Point

风格不统一 提交于 2019-11-28 06:54:40
问题 I drew a line that is at an angle based on a slider. I am trying to make the line's end Y coordinate a certain number (let's say 300), even if it is at an angle. Any ideas on how to do this? Here is the work on my line so far: double angle = intAngle; angle = angle * Math.PI / 180; double length = 300; graphics.setColor(Color.RED); double startX = 300; double startY = 100; double endX = startX + length * Math.cos(angle); double endY = startY + length * Math.sin(angle); double end2X; double

2d Array in Spiral Order

牧云@^-^@ 提交于 2019-11-28 05:59:08
问题 I'm trying to fill an array in spiral order. So far, I can print the array in spiral order, but is there a way to modify the array so that i can fill it in spiral order and then just print the array? I'd like it to go in decreasing order like a countdown. Please help! public class Spiral { public static void main(int m, int n) { // create m by n array of integers 1 through m*n int[][] values = new int[m][n]; for (int i = 0; i < m; i++) for (int j = 0; j < n; j++) values[i][j] = 1 + (m*n)*i +

Continuous plot in MATLAB

时光总嘲笑我的痴心妄想 提交于 2019-11-28 05:47:40
问题 I have a loop in my code and I want to plot some variables, In each iteration I plot a new point and I want it to be connected to the previous point. Here is an example code (In this code the loop is unnecessary but in actual code, it's not). n = 500; Fs = 1000; f1 = 10; t = 0; dt = 1 / Fs; for i = 1 : n s = sin(2 * pi * f1 * t); t = t + dt; plot(t,s,'bo'); hold on; axis([0 t(end) -1 1]); end The right one is what I want. I thought of using line but that would get messy (I would have to

Unity iOS Build size is way big

左心房为你撑大大i 提交于 2019-11-28 05:43:52
问题 Currently I'm on the verge of making a 2D puzzle game for iOS . When I zip my project it's size become 16MB approximately. When I build it in xcode the project size become 780MB and when I archive it then it becomes 1.5GB . But the real problem begins when I upload it to test flight for internal and external testing then in iTunes connect it's compressed size became 143MB and Universal install size become 285MB and for different iPhone install size become 160MB in average. Now I think 160MB

Java - Maximum sum in path through a 2D array

妖精的绣舞 提交于 2019-11-28 05:08:30
Basically I have a problem that goes something similar to this: There is a garden of strawberry plants represented by a 2D, square array. Each plant(each element) has a number of strawberries. You start at the top left corner of the array, and you can only move to the right or down. I need to design a recursive method to calculate the paths through the garden and then output which one yields the most strawberries. I think I have an understanding of really really simple recursion problems, but this problem has gone way over my head. I'm not really sure where to start or where to go as far as

How to create an arraylist class that can store multiple objects?

℡╲_俬逩灬. 提交于 2019-11-28 04:51:39
问题 I am a self-learner. Currently, I am making a GUI project in which I need a matrice-type database. I would like to learn how I can create a class that can store multiple objects in an arraylist. Here is my sample code. Please note that this is just my attempt. This code is not finalized, and it's not working. Thank you for your kind help. import java.util.ArrayList; import java.util.List; }} 回答1: I think a better way to do this is to create a user info class to store the information of a

kalman 2d filter in python

怎甘沉沦 提交于 2019-11-28 02:55:48
My input is 2d (x,y) time series of a dot moving on a screen for a tracker software. It has some noise I want to remove using Kalman filter. Does someone can point me for a python code for Kalman 2d filter? In scipy cookbook I found only a 1d example: http://www.scipy.org/Cookbook/KalmanFiltering I saw there is implementation for Kalman filter in OpenCV, but couldn't find code examples. Thanks! Here is my implementation of the Kalman filter based on the equations given on wikipedia . Please be aware that my understanding of Kalman filters is very rudimentary so there are most likely ways to