Search Results

Search found 1872 results on 75 pages for 'matrix mole'.

Page 19/75 | < Previous Page | 15 16 17 18 19 20 21 22 23 24 25 26  | Next Page >

  • 3D Model not translating correctly (visually)

    - by ChocoMan
    In my first image, my model displays correctly: But when I move the model's position along the Z-axis (forward) I get this, yet the Y-axis doesnt change. An if I keep going, the model disappears into the ground: Any suggestions as to how I can get the model to translate properly visually? Here is how Im calling the model and the terrain in draw(): cameraPosition = new Vector3(camX, camY, camZ); // Copy any parent transforms. Matrix[] transforms = new Matrix[mShockwave.Bones.Count]; mShockwave.CopyAbsoluteBoneTransformsTo(transforms); Matrix[] ttransforms = new Matrix[terrain.Bones.Count]; terrain.CopyAbsoluteBoneTransformsTo(ttransforms); // Draw the model. A model can have multiple meshes, so loop. foreach (ModelMesh mesh in mShockwave.Meshes) { // This is where the mesh orientation is set, as well // as our camera and projection. foreach (BasicEffect effect in mesh.Effects) { effect.EnableDefaultLighting(); effect.PreferPerPixelLighting = true; effect.World = transforms[mesh.ParentBone.Index] * Matrix.CreateRotationY(modelRotation) * Matrix.CreateTranslation(modelPosition); // Looking at the model (picture shouldnt change other than rotation) effect.View = Matrix.CreateLookAt(cameraPosition, modelPosition, Vector3.Up); effect.Projection = Matrix.CreatePerspectiveFieldOfView( MathHelper.ToRadians(45.0f), aspectRatio, 1.0f, 10000.0f); effect.TextureEnabled = true; } // Draw the mesh, using the effects set above. prepare3d(); mesh.Draw(); } //Terrain test foreach (ModelMesh meshT in terrain.Meshes) { foreach (BasicEffect effect in meshT.Effects) { effect.EnableDefaultLighting(); effect.PreferPerPixelLighting = true; effect.World = ttransforms[meshT.ParentBone.Index] * Matrix.CreateRotationY(0) * Matrix.CreateTranslation(terrainPosition); // Looking at the model (picture shouldnt change other than rotation) effect.View = Matrix.CreateLookAt(cameraPosition, terrainPosition, Vector3.Up); effect.Projection = Matrix.CreatePerspectiveFieldOfView( MathHelper.ToRadians(45.0f), aspectRatio, 1.0f, 10000.0f); effect.TextureEnabled = true; } // Draw the mesh, using the effects set above. prepare3d(); meshT.Draw(); DrawText(); } base.Draw(gameTime); } Im suspecting that there may be something wrong with how I'm handling my camera. The model rotates fine on its Y-axis.

    Read the article

  • Why does my 3D model not translate the way I expect? [closed]

    - by ChocoMan
    In my first image, my model displays correctly: But when I move the model's position along the Z-axis (forward) I get this, yet the Y-axis doesnt change. An if I keep going, the model disappears into the ground: Any suggestions as to how I can get the model to translate properly visually? Here is how Im calling the model and the terrain in draw(): cameraPosition = new Vector3(camX, camY, camZ); // Copy any parent transforms. Matrix[] transforms = new Matrix[mShockwave.Bones.Count]; mShockwave.CopyAbsoluteBoneTransformsTo(transforms); Matrix[] ttransforms = new Matrix[terrain.Bones.Count]; terrain.CopyAbsoluteBoneTransformsTo(ttransforms); // Draw the model. A model can have multiple meshes, so loop. foreach (ModelMesh mesh in mShockwave.Meshes) { // This is where the mesh orientation is set, as well // as our camera and projection. foreach (BasicEffect effect in mesh.Effects) { effect.EnableDefaultLighting(); effect.PreferPerPixelLighting = true; effect.World = transforms[mesh.ParentBone.Index] * Matrix.CreateRotationY(modelRotation) * Matrix.CreateTranslation(modelPosition); // Looking at the model (picture shouldnt change other than rotation) effect.View = Matrix.CreateLookAt(cameraPosition, modelPosition, Vector3.Up); effect.Projection = Matrix.CreatePerspectiveFieldOfView( MathHelper.ToRadians(45.0f), aspectRatio, 1.0f, 10000.0f); effect.TextureEnabled = true; } // Draw the mesh, using the effects set above. prepare3d(); mesh.Draw(); } //Terrain test foreach (ModelMesh meshT in terrain.Meshes) { foreach (BasicEffect effect in meshT.Effects) { effect.EnableDefaultLighting(); effect.PreferPerPixelLighting = true; effect.World = ttransforms[meshT.ParentBone.Index] * Matrix.CreateRotationY(0) * Matrix.CreateTranslation(terrainPosition); // Looking at the model (picture shouldnt change other than rotation) effect.View = Matrix.CreateLookAt(cameraPosition, terrainPosition, Vector3.Up); effect.Projection = Matrix.CreatePerspectiveFieldOfView( MathHelper.ToRadians(45.0f), aspectRatio, 1.0f, 10000.0f); effect.TextureEnabled = true; } // Draw the mesh, using the effects set above. prepare3d(); meshT.Draw(); DrawText(); } base.Draw(gameTime); } I'm suspecting that there may be something wrong with how I'm handling my camera. The model rotates fine on its Y-axis.

    Read the article

  • parallel to usb driver windows 7 dot matrix printer

    - by user975234
    I recently built a new Core i5 system with Windows 7 Professional. I had planned to hook up my TVS MSP 250 XL printer using a USB to parallel cable Once I plug the cable in, Windows 7 recognizes it as an IEEE-1284 controller and automatically installs the appropriate driver. However, in the status window it reports the following: "USB Printing Support -- Ready to use" "No Printer Attached -- Ready to use" When I then go ahead and manually add the printer using the "virtual printer port for USB" I can add the printer seemingly without problem. Once finished, it appears in the Devices and Printers panel. Yet, all attempts to print on this printer fail. It appears that simply no data is sent to the printer (either by programs like word or adobe or by attempting to print a test page. Does anybody know how to fix this?

    Read the article

  • Speed boost to adjacency matrix

    - by samoz
    I currently have an algorithm that operates on an adjacency matrix of size n by m. In my algorithm, I need to zero out entire rows or columns at a time. My implementation is currently O(m) or O(n) depending on if it's a column or row. Is there any way to zero out a column or row in O(1) time?

    Read the article

  • Creating an adjacency Matrix from a JUNG Graph.

    - by prince
    Graph < Integer, Integer> g = new SparseMultigraph<Integer, Integer>(); g.addVertex(1);g.addVertex(2);g.addVertex(3); g.addEdge(0,1,2 ,EdgeType.DIRECTED);g.addEdge(1,2,3 ,EdgeType.DIRECTED);g.addEdge(2,3,1 ,EdgeType.DIRECTED);g.addEdge(3,1,3 ,EdgeType.DIRECTED); How can I convert this graph into an adjacency matrix taking into consideration that it is a directed graph.

    Read the article

  • Matrix Transpose TSQL

    - by rmdussa
    Can we do matrix transpose (rows become columns and columns become rows) in standard SQL? 1 2 3 4 5 4 5 6 6 7 7 8 9 8 9 1 3 4 5 6 2 4 5 6 7 changes to 1 4 7 1 2 2 5 8 3 4 3 6 9 5 6 4 6 8 5 6 5 7 9 6 7 how about no of rows < no of column ? let's consider the no of rows it's fixed.

    Read the article

  • Read data matrix barcodes on iPhone?

    - by Saurabh
    Hi All, Is there any Open Source project I can use to read data matrix codes (not QR codes, I know I can use ZXing project to read QR Codes) on iPhone? Any JAVA Open Source would also be helpful (I'll convert that into a web service and use on iPhone). Any help would be much appreciated! Thanks Saurabh

    Read the article

  • Performance Optimization for Matrix Rotation

    - by Summer_More_More_Tea
    Hello everyone: I'm now trapped by a performance optimization lab in the book "Computer System from a Programmer's Perspective" described as following: In a N*N matrix M, where N is multiple of 32, the rotate operation can be represented as: Transpose: interchange elements M(i,j) and M(j,i) Exchange rows: Row i is exchanged with row N-1-i A example for matrix rotation(N is 3 instead of 32 for simplicity): ------- ------- |1|2|3| |3|6|9| ------- ------- |4|5|6| after rotate is |2|5|8| ------- ------- |7|8|9| |1|4|7| ------- ------- A naive implementation is: #define RIDX(i,j,n) ((i)*(n)+(j)) void naive_rotate(int dim, pixel *src, pixel *dst) { int i, j; for (i = 0; i < dim; i++) for (j = 0; j < dim; j++) dst[RIDX(dim-1-j, i, dim)] = src[RIDX(i, j, dim)]; } I come up with an idea by inner-loop-unroll. The result is: Code Version Speed Up original 1x unrolled by 2 1.33x unrolled by 4 1.33x unrolled by 8 1.55x unrolled by 16 1.67x unrolled by 32 1.61x I also get a code snippet from pastebin.com that seems can solve this problem: void rotate(int dim, pixel *src, pixel *dst) { int stride = 32; int count = dim >> 5; src += dim - 1; int a1 = count; do { int a2 = dim; do { int a3 = stride; do { *dst++ = *src; src += dim; } while(--a3); src -= dim * stride + 1; dst += dim - stride; } while(--a2); src += dim * (stride + 1); dst -= dim * dim - stride; } while(--a1); } After carefully read the code, I think main idea of this solution is treat 32 rows as a data zone, and perform the rotating operation respectively. Speed up of this version is 1.85x, overwhelming all the loop-unroll version. Here are the questions: In the inner-loop-unroll version, why does increment slow down if the unrolling factor increase, especially change the unrolling factor from 8 to 16, which does not effect the same when switch from 4 to 8? Does the result have some relationship with depth of the CPU pipeline? If the answer is yes, could the degrade of increment reflect pipeline length? What is the probable reason for the optimization of data-zone version? It seems that there is no too much essential difference from the original naive version. EDIT: My test environment is Intel Centrino Duo processor and the verion of gcc is 4.4 Any advice will be highly appreciated! Kind regards!

    Read the article

  • MATrix LABoratory interview questions?

    - by Shane
    I programmed in MATrix LABoratory for many years, but switched to using R exclusively in the past few years so I'm a little out of practice. I'm interviewing a candidate today who describes himself as an expert? What interview questions that I should be asking?

    Read the article

  • Understanding this matrix transposition function in Haskell

    - by dmindreader
    This matrix transposition function works, but I'm trying to understand its step by step execurtion and I don't get it. transpose:: [[a]]->[[a]] transpose ([]:_) = [] transpose x = (map head x) : transpose (map tail x) with transpose [[1,2,3],[4,5,6],[7,8,9]] it returns: [[1,4,7],[2,5,8],[3,6,9]] I don't get how the concatenation operator is working with map. It is concatenating each head of x in the same function call? How?

    Read the article

  • Is there an Open Source licence matrix?

    - by tobsen
    I am trying to find a simple matrix overview of the various licenses around open source software but can't find anything useful. I would like to know whether software under a certain licence can be used in commercial closed source software, if there has to be the original source code included, if the licence has to be redistirbuted, etc. I know this is a difficult topic because I guess only the minority of programmers are also moonlighting lawyers - neither am I.

    Read the article

  • OpenGL: Implementing transformation matrix stack

    - by Jakub M.
    In a newer OpenGL there is no matrix stack. I am working on a simple display engine, and I am going to implement the transformation stack. What is a common strategy here? Should I build a push/pop stack, and use it with a tree representing my model? I suppose this is the "old" approach, that was deprecated in the newer OpenGL versions. Maybe then it is not the best solution (it was removed for some reason)

    Read the article

  • To find a determinate of Matrix using Boost library in c++

    - by user314097
    Hi, I' am required to convert a MATLAB function into C++, and this requires me to find determinate of a matrix. I was told that use of BOOST library would make my job easier. I went through the documentation of BOOST Library, but couldn't find much info about the same. If anyone could give a template for the above operation, It would be of lot of help and would be greatly appreciated. Thanks Regards

    Read the article

  • Using rowDiffs() to calculate difference in values in matrix

    - by user1723765
    I'm using the rowDiffs() command to calculate the step by step difference in 116 rows in a matrix. I get the following error: Error in r[i1] - r[-length(r):-(length(r) - lag + 1L)] : non-numeric argument to binary operator I have no idea why this is happening. I could take the diff() separately for each row and it would work. Any ideas? Here's the data: https://dl.dropbox.com/u/22681355/data.csv Code: a=rowDiffs(data)

    Read the article

  • Is this overly clever or unsafe?

    - by Liberalkid
    I was working on some code recently and decided to work on my operator overloading in c++, because I've never really implemented it before. So I overloaded the comparison operators for my matrix class using a compare function that returned 0 if LHS was less than RHS, 1 if LHS was greater than RHS and 2 if they were equal. Then I exploited the properties of logical not in c++ on integers, to get all of my compares in one line: inline bool Matrix::operator<(Matrix &RHS){ return ! (compare(*this,RHS)); } inline bool Matrix::operator>(Matrix &RHS){ return ! (compare((*this),RHS)-1); } inline bool Matrix::operator>=(Matrix &RHS){ return compare((*this),RHS); } inline bool Matrix::operator<=(Matrix &RHS){ return compare((*this),RHS)-1; } inline bool Matrix::operator!=(Matrix &RHS){ return compare((*this),RHS)-2; } inline bool Matrix::operator==(Matrix &RHS){ return !(compare((*this),RHS)-2); } Obviously I should be passing RHS as a const, I'm just probably not going to use this matrix class again and I didn't feel like writing another function that wasn't a reference to get the array index values solely for the comparator operation.

    Read the article

  • computing matting Laplacian matrix of an Image

    - by ajith
    hi everyone, i need to compute Laplacian Matrix-L for an image(nXn) in opencv...computing goes as follows.......... dij - 1/|wk|{[1+1/(e/|wk|+s2)][(Ii-µk)*(Ij -µk)]}.... for all(i,j)?wk,summing over k yields (i,j)th element of L. where Here dij is the Kronecker delta,µk and s2k are the mean & variance of intensities in the window wk around k,and |wk| is the number of pixels in this window.wk is 3X3 window... here am not clear about 2 things... 1.what ll be the size of L?nXn or (nXn)X(nXn)?? 2.how to select Ii and Ij separately in 2D image?

    Read the article

  • Vectorizatoin of index operation for a scipy.sparse matrix

    - by celil
    The following code runs too slowly even though everything seems to be vectorized. from numpy import * from scipy.sparse import * n = 100000; i = xrange(n); j = xrange(n); data = ones(n); A=csr_matrix((data,(i,j))); x = A[i,j] The problem seems to be that the indexing operation is implemented as a python function, and invoking A[i,j] results in the following profiling output 500033 function calls in 8.718 CPU seconds Ordered by: internal time ncalls tottime percall cumtime percall filename:lineno(function) 100000 7.933 0.000 8.156 0.000 csr.py:265(_get_single_element) 1 0.271 0.271 8.705 8.705 csr.py:177(__getitem__) (...) Namely, the python function _get_single_element gets called 100000 times which is really inefficient. Why isn't this implemented in pure C? Does anybody know of a way of getting around this limitation, and speeding up the above code? Should I be using a different sparse matrix type?

    Read the article

  • JAVA: Sort ArrayList<ArrayList<Integer>> on multiple columns

    - by Bob
    First, I did do my homework searching before posting here. My requirement seems to be slightly different compared to questions posted out there. I have a matrix like ArrayList<ArrayList<Integer>> in the following form | id1 | id2 | score | |-----|-----|-------| | 1 | 3 | 95% | | 1 | 2 | 100% | | 1 | 4 | 85% | | 1 | 5 | 95% | | 2 | 10 | 80% | | 2 | 15 | 99% | I want to sort the matrix column-wise (first using score, then the id1). I already have the id1 in a sorted manner. That means I also need to sort all records with the same id1 first by using score, second by the id2. The reason for doing this is to create a ranking of the id2 in each id1. The result for the above example would be: | q_id | d_id | rank | score | |------|------|------|-------| | 1 | 2 | 1 | 100% | | 1 | 3 | 2 | 95% | | 1 | 5 | 3 | 95% | | 1 | 4 | 4 | 85% | | 2 | 15 | 1 | 99% | | 2 | 10 | 2 | 80% | How can I achieve this in Java using some built-in methods of collections?

    Read the article

< Previous Page | 15 16 17 18 19 20 21 22 23 24 25 26  | Next Page >