C++ :: Getting A Point Rotation Or Normal From 4 Vectors?

Dec 31, 2014

I'm trying to get a rotation of a spefic point in a 3D space using 3 or 4 coordinate/vector.

For example, I want to know the rotation of (5,5,5)

Using 4 vectors for example (0,0,0), (10,10,10), or 10,0,10, etc. (3 minimum)

View 2 Replies


ADVERTISEMENT

C++ :: List Of Vectors (vector Of N Vectors Of M Elements)

Mar 19, 2014

I create a list of vectors (a vector of n vectors of m elements).

std::vector <std::vector <int> > vsFA (n, std::vector<int>(n));

How I assign values? I try below, but not worked

void armazenaFA( std::vector <int> &vFA) // this function only knows about vFA
{ vsFA[n] [m]= simTime().dbl();
OR
vsFA[n].push_back(simTime().dbl());
}

View 1 Replies View Related

C :: How To Change MPI Broadcast Into Asynchronous Point To Point Communication

Jun 26, 2013

I have one code that use MPI broadcast and I want to change it into Asynchronous Point to Point communication. I am newbie in Parallel programming. Looking for implementation of one simple same program in broadcast and P2P ?

View 6 Replies View Related

C++ :: Create Two Vectors And Then Loop Through The Vectors

Sep 19, 2014

This is probably a very basic question, but I need to create two vectors and then loop through the vectors and output each pair that is found.

The user will input min1 and max1 with step1 for the first vector and min2 and max2 and step2 for the second vector. Then the loops will go through and return the combinations will return each pair of the two vectors.

So if I input min1=1 and max1=10 and step1=1 and same for vector two the return would be:

[1,1]
[1,2]
.
.
.
[10,10]

This is for part of a homework assignment, but I can't continue on the assignment without first getting this simple part to work.

View 1 Replies View Related

C :: AVL Left And Right Rotation

Feb 7, 2013

I am creating and implementing a left and a right rotation to balance a bst into an avl tree. I have made and tried 5 different codes that are commented in the functions left_rotate() and right_rotate() but none have run correctly. Sometimes the program works, sometimes there is a segmentation fault and sometimes not all inserted numbers are shown.

avl.c

Code:
#include<stdio.h>#include<stdlib.h>
#include<time.h>
#include "avl.h"
#define N 10
void swap(int *a, int *b){

[Code] ....

View 1 Replies View Related

C :: Image Rotation Without Cropping

Nov 4, 2014

I am new to image processing..... and I am learning the concepts.

Recently I have done image rotation of grey scale image using the following formula:

x' = xcos(theta)-ysin(theta)
y' = xsin(theta)+ycos(theta)

The problem i have faced is image is getting cropped.

I want to rotate an image without cropping. I have searched a lot but I am not getting any algorithm based on C. How to get the algorithm for image rotation without cropping.

View 2 Replies View Related

C++ :: Visualizing 3D Rotation Using Quaternion Data

Jun 10, 2014

Just bought a new ST Micro iNEMO-M1 system, and am looking to have my code visually show me the rotation information. I've got a working C++ code which actively acquires data from the sensor, and I'm looking to extend that into some visual interface which will show me on-screen the position of the sensor.

I figure using rotation information in the form of quaternion data is the most useful (want to avoid the gimbal lock problems associated with Roll/Pitch/Yaw).

What would be the best method to visualize the rotation of my sensor in real-time?

View 2 Replies View Related

C# :: Vertice Location After Quaternion Rotation

Aug 16, 2012

I have a 3d Point in space. From this point I have vertices defind by(scale). I have a Quaternion representing the rotation of the object (lets say a block). So...

(1) I know the point in local and world space and can translate.

(2) I know the scale of the object and it's starting vertices intersections at zero rotation.

(3) I have the quaternion which represents the 3d rotation and can translate that to degrees and Eulers.

How do i find the exact points of the vertices after the rotation. (what I'm attempting to do is plot points from vertice to vertice all along the sides/top/bottom of the object.)I have looked at Matrix4 transformations and Quaternions and still do not understand how to find the vertices after rotation.

View 8 Replies View Related

C++ :: How To Move Sprite Depending On Rotation

Jan 13, 2015

how I want my sprite movement to work: if my sprite is faced upwards and i press W, it will move up. If my sprite is faced to the right and i press W, it will go right. etc. // It doesn't work like that right now and how to do it.The sprite's rotation works fine.

if(sf::Keyboard::isKeyPressed(sf::Keyboard::Q)) {
playerSprite.rotate(-0.08 * dt);
} else if(sf::Keyboard::isKeyPressed(sf::Keyboard::E)) {
playerSprite.rotate(0.08 * dt);

[code]....

My question is how do I move the character depending on the rotation?

Also, you might see the "if(havePlayersCollided == false) {playerSprite.move(yadiyada)}" . yes i dont need the haveplayerscollided function because it doesnt work the way I want it to. I might make a thread for it in the future, but right now I need to get the rotation movement fixed before I move onto the collision detection between players.

View 7 Replies View Related

C++ :: Finding Rotation Direction From Two Orientations?

Mar 4, 2014

It is technically not a programming question and is more maths oriented. It has to do with game AI and specifically getting the AI to rotate correctly. I am trying to create the base method that handles AI rotation. It will take a target orientation and rotate the entity from it's current orientation to that target orientation.

Let's say we have a Entity that has the orientation of 1.57079 Radians (90 Degrees) and we want to change that Entity's orientation to 0 Radians (0 Degrees). How would one find the correct way to rotate from just them two orientations (IE find the shortest rotation direction from a current orientation to a target orientation)?

As my implementation stands now the Entity rotates just fine I think but always in a clockwise rotation (Because I can't figure out how to determine the best rotation direction). For example using the previous number (1.57079 Radians to 0 Radians) the Entity will rotate all the way around 270 Degrees clockwise instead of rotating just 90 degrees counter-clockwise.

I have thought about possibly projecting vectors a short distance forward from the current orientation and target orientation to figure out the rotation direction but not sure if that is a good way to implement it.

View 1 Replies View Related

C++ :: Array Char Rotation And Arrow Key Usage

Apr 27, 2013

I am doing a project for a class which involves making a game where there is an arrray that holds a player (you) and a zombie (comp). The player is suppose to be able to turn clockwise or counter clockwise, move forward, and backward and shoot. Im having trouble trying to rotate the char in an array. I am also trying to switch from using the W,S,D,A to the arrow keys but doesnt seem to work.

#include <iostream>
#include <windows.h>
#include "color.h"
using namespace std;
using namespace Petter;
const int COL = 15;
void initBoard(char[][COL], int, int);

[Code] ....

View 5 Replies View Related

C# :: Image Rotation Leaves Null Areas

Jan 29, 2015

I am working on a Paint program and I have a nice routine (copied from the Net) that beautifully rotates my Image by any chosen degree, and even preserving the entire Image with a 'noclipping' option.

The problem is - That after the rotation, say 45degrees, the areas in the corners, that originally were not part of the Image, cannot be drawn to. I have an 'eye dropper tool' that shows these areas to be null, having no color. My drawing tools will not work on these areas.

public static Bitmap RotateImage(Image image, float rotateAtX, float rotateAtY, float angle, bool bNoClip) {
int W, H, X, Y;
if (bNoClip) // use Clipping {
double dW = (double)image.Width;
double dH = (double)image.Height;
double degrees = Math.Abs(angle);

[Code] ....

View 13 Replies View Related

C# :: Creating Normal Magic Squares

Jan 13, 2014

I have been asked to develop a program with 6 methods which I have presented below. The aim of the program is to find and generate a magic square with a given dimension. This is a console program and so the 'Main' is also provided. However, I am having a problem with my code. When ever I try to generate a magic square it continuously cycles through 'forever' and I have never yet got a magic square; no matter what dimension I enter.

I must use methods 'CreateRandomlyAssignedArray' and 'CheckSquareMatrix'. There is another method 'SearchForValue', which we were told to creat. How this can be useful.

I have provided my code below:

class Program {
static Random rand = new Random();
static void Main(string[] args) {
int[,] array = new int[5,5];
array = GenerateMagicSquare(5);

[Code] ....

View 1 Replies View Related

Visual C++ :: Detect And Find Rotation Angle If Skeleton Tracked Turned 180 Degree To Kinect

Sep 25, 2013

I m developing an application using kinect.The IDE I use is Visual studio 2012 and kinect SDK 1.8.I m developing using vc++

I want to overlay an image on the person tracked when the person turns 180 degress to kinect. ie the person is not facing the kinect.

how do i track the rotation angle of the person as he/she turns away from kinect.

View 7 Replies View Related

C :: Normal Distribution Histogram - Random Numbers

Feb 6, 2013

Write a function that generates 1000 normally distributed (Gaussian Probability Distribution) random numbers. Range should be between -3 and +3. Numbers should be double floating point.

There's more to it than that, but I've got it from there.

View 7 Replies View Related

C :: Difference Between Functions As Pointer And Normal Function

Aug 30, 2014

whats the difference between functions as pointer and normal function, eg:

void function1(void)
void *function1(void)

What is the difference between the two?I'm doing parallel programming and we use pointer functions (void *function1(void)) when calling threads. I want to why it is done.

View 6 Replies View Related

C++ :: Normal Rand Generator - Class Functions

Sep 19, 2014

So I have an object of class NRG (Normal Rand Generator) which takes, as an argument to it's constructor, an object of class RG (Rand generator).

template<typename RG>
class NRG {
RG rg;
public:
NRG(RG r):rg(r){}
double operator()();

An object of this class will return a normal random when it's member function operator()() is called:

template<typename RG>
double class NRG::operator()() {
static int flag = 0;
static double N2 = 0.0;
if(flag==0)

[Code] ....

However, when I run this I get an error which says:

C:UsersavadhootDesktopb.cpp|69|error: 'template<class RG> class NRG' used without template parameters|
C:UsersavadhootDesktopb.cpp|69|error: expected identifier before 'operator'|
C:UsersavadhootDesktopb.cpp|69|error: two or more data types in declaration of 'operator()'|
||=== Build failed: 3 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|

View 3 Replies View Related

C++ :: Generating Random Number Of Normal Distribution

Mar 12, 2013

I am generating random number of normal distribution (0,1) but i suspect maybe I have done it wrong. The generator I use right now is

srand(time(0));
std::random_device rd;
std::mt19937 gen(rd());
std::default_random_engine generator;
std::normal_distribution<double> distribution(0,1);

Am I doing the right thing? Whether this is a real random number generator?

View 4 Replies View Related

C++ :: Find Normal To A Terrain Represented By A Texture

Mar 27, 2014

The following function finds the normal to a terrain represented by a texture. I found it somewhere online , it works but i couldn't understand the math behind it. So , How (or Why ?) does it works ?

//psuedo code
Vector2 normal(x,y) {
Vector2 avg;
for(int w = -3; w <= 3; w++) {
for(int h = -3; h <= 3; h++)

[Code] ....

View 6 Replies View Related

C++ :: Converting Cmdline Into Normal Function So Can Put Into Library

Apr 23, 2013

I need to convert this code into a normal function that can be put into a library.

Code:

#include <windows.h>
#include <stdio.h>
#include <tchar.h>

[Code].....

Like on line 21&22, I need to get the stuff from within the program, not through cmdline.

View 1 Replies View Related

C :: Convert Roman Numeral Inputs To Normal Numbers?

May 4, 2014

I have a fascination with Roman numerals and would like to create a C program that converts Roman numeral inputs to normal numbers.

I want to keep everything simple and only use the C library for the coding.

View 4 Replies View Related

C :: How To Create A Document Where All Text Is Normal But One Word Is Flashing

Feb 18, 2013

So i have to create a document where all the text is normal, but on the sides one word, a important word flashes...

how would i code that in c ?????????

oh yeah i am useing complier Bloodshed Dev C++ on windows 7

View 9 Replies View Related

C++ :: How To Generate Real Random Number From Normal Distribution

Jun 26, 2013

I want to generate random numbers of normal distribution and use scentence like

std::default_random_engine generator;
std::normal_distribution<double> distribution(0,1);
arrayX[i][j]=distribution(generator);

But I find that each time the array I got are the same. So how should I generate random numbers with different seedings with normal distribution?

View 2 Replies View Related

C++ :: Produce Normal Distribution Random Number Several Times

Aug 22, 2014

I wrote the following program shown below that produces a normally distributed random number several times, and then takes the average of them. The problem that I have been having though is that the output it has been producing is 0.0288385 despite the fact that I set the mean of the normal distribution to be 0.1. Why this output value would be so far off from 0.1 despite having averaged over such a large number of random numbers namely 10,000 of them? Also, how to randomly seed this random number generator such that it gives a different value each time its run perhaps by seeding it with the windows timer? Below is the program.

#include <iostream>
#include <random>
using namespace std;
int main() {
default_random_engine generator;
normal_distribution<double> distribution1(0.1,3.0);
double number1,sum,n;

[code].....

View 2 Replies View Related

C++ :: Normal Distribution Range - Select Objects On A Vector

May 23, 2014

I'm implementing an normal_distribution to select objects on a vector. The thing is I can't use values greater then 1 or less then -1. Here is what could be done:

gausx=gaus_distributionx(generator);
while((gausx>1) || (gausx<-1))
gausx=gaus_distributionx(generator);

The question is if the distribution would loose it's power to be a normal distribution, because some of the gerated numbers wouldn't be used. Any way to set ranges for the distribution?

View 6 Replies View Related

C/C++ :: Unable To Calculate Normal Vertex For Terrain Mesh

Apr 17, 2014

Okay I'm trying to calculate vertex normals for my terrain mesh. Obviously it's not working, but I can't work out why. Either its the way I calculate the normals, or the way I assign the final normal.

line 416 is where the normals are assigned to each point in my mesh. line 735 is the function for normals

class Normal3d {
private:
double x;
double y;
double z;
public:
Normal3d(double nx, double ny, double nz) : x(nx), y(ny), z(nz) {
}
Normal3d() {};

[Code]...

View 6 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved