vectors

Signed Angle in 3D Vectors

This is a purely math question, I believe. I have a camera object in an arbitrary coordinate system. I have the direction vector of the camera, and I have a vector that points in the direction of north along the surface of the sphere. I wish to calculate the angle of the camera in regards to the north vector. Is there a simple way to c...

How do I calculate the normal vector of a line segment?

Suppose I have a line segment going from (x1,y1) to (x2,y2). How do I calculate the normal vector perpendicular to the line? I can find lots of stuff about doing this for planes in 3D, but no 2D stuff. Please go easy on the maths (links to worked examples, diagrams or algorithms are welcome), I'm a programmer more than I'm a mathematic...

Finding points on a line with a given distance

I have a question i know a line i just know its slope(m) and a point on it A(x,y) How can i calculate the points(actually two of them) on this line with a distance(d) from point A ??? I m asking this for finding intensity of pixels on a line that pass through A(x,y) with a distance .Distance in this case will be number of pixels. ...

Version Control/Configuration Management for Avaya PBXs?

Hi, all. Here at Acme Widgets, we use an Avaya 8xxx series PBX. Some of the Vectors that are coded into the PBX are super important, in that if they're changed in the wrong way, pretty much all of our telephony arena applications and features go haywire (IVR, CTI, CRM, and ACD). There have been some recent discussions where we've disa...

How do I make a matrix from a list of vectors in R?

Goal: from a list of vectors of equal length, create a matrix where each vector becomes a row. Example: > a <- list() > for (i in 1:10) a[[i]] <- c(i,1:5) > a [[1]] [1] 1 1 2 3 4 5 [[2]] [1] 2 1 2 3 4 5 [[3]] [1] 3 1 2 3 4 5 [[4]] [1] 4 1 2 3 4 5 [[5]] [1] 5 1 2 3 4 5 [[6]] [1] 6 1 2 3 4 5 [[7]] [1] 7 1 2 3 4 5 [[8]] [1] 8 1 2 3...

C++ Vectors Problem

well i have most probably an extremly stupid problem but could not figure it out and I m about to lose my sanity hope someone can help vector<CvMat*> sample; for(int x = 0; x < 29; x += 2) { for(int b = 0; b < 22; b += 2) { cvmSet(g, 0, b, cvmGet(NormalVector, 0, x + b)); cvmSet(g, 0, b + 1, cvmGet(NormalVector, 0, ...

C++ Vector Pointers to Objects

I'm using a vector of pointers to objects. These objects are derived from a base class, and are being dynamically allocated and stored. For example, I have something like: vector<Enemy*> Enemies; and I'll be deriving from the Enemy class and then dynamically allocating memory for the derived class, like this: enemies.push_back(new M...

Vector math and rectangles

I know this is more high school math(wow been a long time since I was there) but I am trying to solve this programatically so I am reaching out to the collective knowledge of stackoverflow Given this layout: Midpoint is my reference point and in an array I have the vector points of all other points (P) I can get to this state with c...

How to "snap" a directional (2D) vector to a compass (N, NE, E, SE, S, SW, W, NW)?

I have a bunch of vectors normal to window surfaces in a 3D modelling software. Projected to the XY-Plane, I would like to know in which direction they are facing, translated to the 8 compass coordinates (North, North-East, East, South-East, South, South-West, West and North-West). The vectors work like this: the X axis represents Eas...

Global angle of 3d vectors

I have 3 Vectors, Up Right and Front that represent a direction. I need to convert these into an XYZ angle (3 floats) so i can use with glRotatef() Please help [EDIT] Its not rendering properly. can you see if its anything blatant here: pastebin.com/f6683492d ...

Autocorrelation and shift vectors

Basically I'll be using Autocorrelation method to try to find cloned regions within an image. This is what i did in MATLAB i = imread ('D:\image.jpg') I = rgb2gray(i); imshow(I); f = fspecial('LOG'); h = imfilter(I,f); x = xcorr2(double(h), double(h)); imagesc(x); figure(gcf) basically loading up an image, changing it to greyscale, ap...

Vector assignment problem

#include "iostream" #include "vector" using namespace std; const vector<int>& Getv() { vector<int> w(10); w[0]=10; cout<<w.size()<<endl; return w; } //Now when I write in main: vector<int>v = Getv();//Throws exception //and the below rows has no effect vector<int>v; v=Getv()//w does not change please what is the problem? Hani Almousl...

How to get x and y coordinates from a linear grid simply?

I have myself a linear grid of Vector2s stored in a Vector2[,] array, and i also have another Vector2 that lies within this grid. How can i simply extract both the nearest 4 grid points and their indexes in the array? I'm totally stumped... ...

How do you make a new dataset given a set of vectors?

Is there a way in R to build a new dataset consisting of a given set of vectors -- median1, median2, median3, median4 -- which are median vectors from a previous dataset s? median1 = apply(s[,c("A1","B1","C1","D1","E1","F1","G1","H1","I1")],1,median) median2 = apply(s[,c("A2","B2","C2","D2","E2","F2","G2","H2","I2")],1,median) median3 ...

Software for drawing scientific data

I'm looking for a software for drawing scientific data, mostly vectors, coordinate systems and diagrams, for example: ...

Best way to store and retrieve this..?

I've been trying all night, and talk of maps, arrays, vectors and hash_maps have filled my head. im just confused now. i posted a previous question here: http://stackoverflow.com/questions/1687085/c-map-really-slow problem was fixed but it seems map's are still not fast enough. i need to keep adding data. data is added ALOT during run t...

How do I put a vector inside of a struct in Go?

I'm trying to put a vector variable inside a struct in Google's Go programming language. This is what I have so far: Want: type Point struct { x, y int } type myStruct struct { myVectorInsideStruct vector; } func main(){ myMyStruct := myStruct{vector.New(0)}; myPoint := Point{2,3}; myMyStruct.myVectorInsideStruct.Push(myPoint); } ...

Are vector assignments copied by value or by reference in Google's Go language?

In the following code, I create one peg puzzle then do a move on it which adds a move to its movesAlreadyDone vector. Then I create another peg puzzle then do a move on it which adds a move to its movesAlreadyDone vector. When I print out the values in that vector for the second one, it has the move in it from the first one along with th...

C++: Iterating through a vector of vectors

Hey there! I'm doing this project and right now I'm trying to: create some of objects and store them in vectors, which get stored in another vector V iterate through the vectors inside V iterate through the objects inside the individual vectors Anyway, I was just searching the web and I came accross the stl for_each function. It seem...

C++ type casting vector class

I have two vector classes: typedef struct D3DXVECTOR3 { FLOAT x; FLOAT y; FLOAT z; } D3DXVECTOR3, *LPD3DXVECTOR3; and class MyVector3{ FLOAT x; FLOAT y; FLOAT z; }; and a function: void function(D3DXVECTOR3* Vector); How is it possible (if it's possible) to achieve something like this: MyVector3 vTest; f...