0
голосов
2ответов
1356 просмотров

How do i use perspective projection in this library

i found a library called pyeuclid and it seems to do what i want in respect to 3D math. it contins a 3D vector class and a 4X4 matrix class capable of transformations like rotate,translate and scale. matrix creation is simple, simply pass along the arguments and the matrix is created. >&gt...

17
голосов
4ответов
38954 просмотров

Convert Quaternion rotation to rotation matrix?

Basically, given a quaterion (qx, qy, qz, qw)... How can i convert that to an OpenGL rotation matrix? I'm also interested in which matrix row is "Up", "Right", "Forward" etc... I have a camera rotation in quaternion that I need in vectors...

1
голосов
1ответов
726 просмотров

CUBLAS or supported libraries, and emphasis for reading for a beginner

I'm trying to harness the power of the GPU (nVidia Quadro NVS140M) to speed up some matrix computations in my project. I'm reading through some documentation (programming guide, best practices guide, and reference manual), but not sure which section(s) I should focus on. It would be great if I ca...

24
голосов
4ответов
55817 просмотров

Matrix of unknown length in MATLAB?

I'm trying to set up a zero matrix of variable length with two columns into which I can output the results of a while loop (with the intention of using it to store the step data from Euler's method with adjusted time-steps). The length will be determined by the number of iterations of the loop. ...

0
голосов
2ответов
144 просмотров

Efficient Indexing method for a 2 by 2 matrix

If I fill numbers from 1 to 4 in a 2 by 2 matrix, there are 16 possible combinations. What I want to do is store values in an array of size 24 corresponding to each matrix. So given a 2 by 2 matrix, I want a efficient indexing method to index into the array directly.( I dont want comparing all ...

2
голосов
2ответов
2241 просмотров

Efficiency of perspective projection vs raytracing/ray casting

I have a very general question. I wish to determine the boundary points of a number of objects (comprising 30-50 closed polygons (z) each having around 300 points(x,y,z)). I am working with a fixed viewport which is rotated about x,y and z-axes (alpha, beta, gamma) wrt origin of coordinate system...

6
голосов
4ответов
8733 просмотров

FLOPS Intel core and testing it with C (innerproduct)

I have some misconceptions about measuring flops, on Intel architecture, is a FLOP one addition and one multiplication together? I read about this somewhere online and there is no debate that could reject this. I know that FLOP has a different meaning on different types of cpu. How do I calculat...

0
голосов
1ответов
189 просмотров

How to cycle through matrix blocks?

I have some matrix which I want to cycle through blocks, the matrix could be of many different sizes, but I can know the size, is there a way to fast cycle through blocks? i.e: to fast output the indexes of the blocks, suppose a matrix of 4*4 I should have: Block1: (0,0),(0,1)(1,0)(1,1) Block2:...

1
голосов
1ответов
644 просмотров

tformfwd and tforminv - what's the difference?

Suppose I have an arbitrary transformation matrix A such as, A = 0.9966 0.0007 -6.5625 0.0027 0.9938 1.0598 0 0 1.0000 And a set of points such that their x and y coordinates are represented by X and Y respectively. And suppose, [Xf Yf] = tformfwd(mak...

1
голосов
2ответов
3760 просмотров

c++ opengl converting model coordinates to world coordinates for collision detection

(This is all in ortho mode, origin is in the top left corner, x is positive to the right, y is positive down the y axis) I have a rectangle in world space, which can have a rotation m_rotation (in degrees). I can work with the rectangle fine, it rotates, scales, everything you could want it to ...

0
голосов
2ответов
230 просмотров

Wrong results in JavaScript table

I'm trying to create a matrix for 12-tone music. The numbers between 0-11 show the intervals between pitches. My script shows the matrix correctly as it runs initially with the page; but when we do another calculation with the button, it goes messy, even with the same pitch set. Here is my scri...

3
голосов
7ответов
634 просмотров

How can I code this problem? (C++)

I am writing a simple game which stores datasets in a 2D grid (like a chess board). Each cell in the grid may contain a single integer (0 means the cell is empty). If the cell contains a number> 0, it is said to be "filled". The set of "filled" cells on the grid is known as a "configuration". ...

8
голосов
2ответов
7306 просмотров

converting a matrix of lists to a regular matrix

Take the following code: foo <- list() foo[[1]] <- list(a=1, b=2) foo[[2]] <- list(a=11, b=22) foo[[3]] <- list(a=111, b=222) result <- do.call(rbind, foo) result[,'a'] In this case, result[,'a'] shows a list. Is there a more elegant way such that result is a "regular" matrix o...

2
голосов
4ответов
9599 просмотров

Translate vector by matrix

I have a 4*4 matrix and a 3d vector. I need to translate my vector by the matrix. Not too much crazy maths notation please because I don't understand it. An example in something close to java would be fab!

0
голосов
5ответов
845 просмотров

The right way to manage a big matrix in Java

I'm working with a big matrix (not sparse), it contains about 10^10 double. Of course I cannot keep it in memory, and I need just 1 row at time. I thought to split it in files, every file 1 row (it requires a lot of files) and just read a file every time I need a row. do you know any more effici...

0
голосов
3ответов
2441 просмотров

read matrix from a file in C C++

Just wonder, for a matrix stored in a file as what it is, i.e. each line in the file being a row of the matrix where elements are separated by space(s), how can I predetermine the size of the matrix, then create an array of the same size and read it into the array in C and C++? If you have some c...

1
голосов
2ответов
3601 просмотров

Transforming a NxN binary matrix to a zero matrix using minimum row and column toggles

This is about the question i posted regarding converting one NxN binary matrix to another . The question i asked is a code-challenge problem . However, a similar question was asked at How to do matrix conversions by row and columns toggles?. I went through that thread,and have gained some idea ab...

0
голосов
2ответов
2613 просмотров

print a jpg

I've been trying to print a dynamically loaded jpg and for some reason it's never printing to scale, not sure what I'm doing wrong so here's what I've done so far var request:URLRequest = new URLRequest(getAbsPath("pages/" + pagePrint + "_big.jpg")); var loader:Loader = new Loader(); loader.load...

8
голосов
1ответов
1689 просмотров

Limited matrices in Ruby

How come the Matrix class has no methods to edit its vectors and components? It seems like everything inside a matrix can be read but not written. Am I mistaken? Is there some third-party elegant Matrix-like class that would allow me to delete rows and intentionally edit them? Please, notify me ...

0
голосов
1ответов
735 просмотров

Troubles: Matrices, Vectors and Arrays

As far as I understood, matrices are very inflexible to work with. Therefor, I'm trying to get an array of vectors do deal with. My needs are: to be able to add vectors and make arithmetical operations on their components. Writing the code below, require 'matrix' x = Matrix.rows( IO.readlines(...

2
голосов
6ответов
4953 просмотров

Matrix Circular Shift

Does anyone know an efficient way to right circular-shift a matrix? Btw, the matrix is binary but a method to solve a non-binary matrix is also fine. Right now, I'm thinking of implementing a circular array for the rows of my matrix and updating each row whenever a shift operation is required. ...

6
голосов
2ответов
10812 просмотров

Calculating vertices of a rotated rectangle

Hey guys, I am trying to calculate the vertices of a rotated rectangle (2D). It's easy enough if the rectangle has not been rotated, I figured that part out. If the rectangle has been rotated, I thought of two possible ways to calculate the vertices. 1) Figure out how to transform the vertices ...

0
голосов
5ответов
1155 просмотров

Java: Cache results of computation?

I'm writing a program to calculate a value that is a measure of the similarity between two objects. The comparison is commutative, so compare(a, b) == compare(b, a). The program's output to the console is a matrix of all results. However, since the matrix has each comparison twice ((a, b) and (b...

2
голосов
1ответов
4297 просмотров

Hide matrix Gridlines SQL Server Reporting Services 2005

I am creating a report using SQL Server Reporting Services in Visual Studio 2005 (SSRS). I have placed a matrix in a list. The data and the matrix are working fine. However I can't seem to find a way to hide the matrix grid lines at runtime. Also, I have set the visibility of the static 1st colu...

0
голосов
1ответов
1679 просмотров

Read a txt file containing a matrix of numbers separated by spaces and lines into an array

I've been trying to read a txt file containing a formatted matrix (9x9) into an int array. The txt file is selected by the user using NSOpenPanel. An example txt file: 2 7 9 1 6 2 1 1 1 9 1 3 3 4 0 6 8 5 5 3 2 9 3 8 6 7 0 6 0 9 2 5 6 4 8 0 3 2 0 4 0 5 0 6 0 4 0 5 4 0 3 9 0 0 6 4 1 3 2 5 7 2 ...

4
голосов
5ответов
4140 просмотров

Rotating cordinates around pivot? (tetris)

I'm attempting to design my very own tetris clone but have run into a little problem with shape rotations. I have a 2 dimensional array representing a 10 x 20 game grid and individual shape objects which when initialised contain coordinates of where on the grid the shape will start falling from....

0
голосов
2ответов
282 просмотров

Speed up text comparisons (with sparse matrices)

I have a function which takes two strings and gives out the cosine similarity value which shows the relationship between both texts. If I want to compare 75 texts with each other, I need to make 5,625 single comparisons to have all texts compared with each other. Is there a way to reduce this n...

6
голосов
6ответов
5971 просмотров

Transpose a 2D array

How do you efficiently transpose a matrix? Are there libraries for this, or what algorithm would you use? E.g.: short src[W*H] = { {1,2,3}, {4,5,6} }; short dest[W*H]; rotate_90_clockwise(dest,src,W,H); //<-- magic in here, no need for in-place //dest is now: { {4, 1}, {5, 2}, ...

0
голосов
1ответов
1939 просмотров

Making Dynamic and Static columns play nicely in Matrix in SSRS 2005

I have a report that shows financial data by year along with a few other bits of static data: every time I try to put in a Column group, it does either above or below the static data: FiscalYear StaticData1 | StaticData2 | StaticData3 | StaticData4 Or: StaticData1 | StaticData2 | StaticData3 ...

15
голосов
4ответов
13844 просмотров

What is a good free (open source) BLAS/LAPACK library for .net (C#)?

I have a project written in C# where I need to do various linear algebraic operations on matrices (like LU-factorization). Since the program is mainly a prototype created to confirm a theory, a C# implementation will suffice (compared to a possibly speedier C++ one), but I would still like a goo...