C/C++ :: Find Angle And Radius Of Given Point Of A Circle
Oct 7, 2013
Let (x,y) be the center of the circle. (x,y) will not be (0,0). I have radius of the circle. Now i want to find the angle and radius of the given point inside the circle.
View 2 Replies
ADVERTISEMENT
Jan 22, 2014
I am drawing a circle using ellipse because there is no explicit command for this.
Code:
pDC->Ellipse(CRect(70, 170, 300, 400));
What is the centre of circle and what is radius in the above command?
View 2 Replies
View Related
Jan 23, 2014
My problem is the following : We have a circle paper of radius R. We will cut off a sector of this circle (with length rem_sec), and the remaining (bigger part) will create a cone. Radius of cone base is r.
I need to create a code that prompts the user to enter circle's radius R and the program will calculate the length of removed sector (rem_sec) so that the created cone has the Max Volume.
I wrote the following code, but it doesn't work. It displays both rem_sec and MaxV = 0.
#include <iostream>
#include <cmath>
#include <iomanip>
#include <conio.h>
using namespace std;
const double PI = 3.1415;
int main() {
double rem_sec;
[Code] ...
View 5 Replies
View Related
Feb 3, 2014
I am facing a programming logic problem. I want to draw radius sized lines from centre of circle to the circle boundary.
My code is:
int x1, y1, x2, y2, i, r, old_xc,old_yc, x,y;
int xc, yc;
x1=170;
y1=300;
x2=70;
y2=400;
pDC->Ellipse(x1,y1,x2,y2);
[Code] .....
The lines are touching the circle boudary at only start while the rest of lines are smaller and the shape is a triangle instead of a pie slice.
View 8 Replies
View Related
Jul 26, 2014
How can I find each and every pixel in a circle so that I can do some operations on it.
View 6 Replies
View Related
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
Mar 31, 2014
I have write a program to read ppm file and write a new ppm file. However, I'm not sure how to find the darkest point in this ppm file.
Note:
1. there are 610200 RGB point, but my new file only created 176196 RGB point.
2. RGB range: 0-255. (0,0,0)= black; (255,255,255)= white
3. When reporting the location of your dark pixels, assume the upper left corner of the image is location 1, 1
Below is my code:
#include<stdio.h>#include<stdlib.h>
typedef struct {
unsigned char red,green,blue;
} pixel_t;
typedef struct {
int x, y;
pixel_t *data;
} PPMImage;
[Code] .....
Here is ppm file: [URL] .....
View 10 Replies
View Related
Nov 7, 2013
Using VC++ 2010 Express. I am creating a dll to export a simple Multiply function so I can use it in Excel/VBA
These e are the steps I am following :
. Create a Win32 C++ Project and give a name. For example: CallDllFromVBA
. Select the DLL option in the Wizard and click Finish
. In the CPP file (here CallDllFromVBA.cpp), add the following code
#include "stdafx.h"
int _stdcall Multiply(int x, int y) {
return x * y;
[Code] ....
The Build output show everything is ok as follows :
CallDllFromVBA.cpp
CallDllFromVBA.vcxproj -> c:documents and settingsadministrateurmes documentsvisual studio 2010ProjectsCallDllFromVBADebugCallDllFromVBA.dll
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
In VBA, I insert a module and add the following code:
Declare Function Multiply Lib _
"c:documents and settingsadministrateurmes documentsvisual studio 2010ProjectsCallDllFromVBADebugCallDllFromVBA.dll" _
(ByVal x As Long, ByVal y As Long) As Long
Sub test()
MsgBox Multiply(2, 4)
End Sub
When I run the Test sub I get the error: 453 - Can't find dll entry point
I also opened the CallDllFromVBA dll with Dependency walker and I can't find the Multiply export function - In fact, the dependency walker doesn't show any function exports at all for the CallDllFromVBA dll !
View 2 Replies
View Related
Mar 6, 2015
I am trying to create a function to find the entry point of my map.But my program does not seem to be working correctly. I am trying to place a dot there because I will have to use recursion to fill up the whole map. But I'm not asking for the answer. I just need writing a function to locate the starting row for the first column of the maze (first non zero element). My code seems to have a bug in it when I try and call my function FindEntry. What I am trying to do is read in column by column until I can find the starting point and then place a dot there with ASCII character 249. This is my code so far:
Code:
#include<stdio.h>
#include<Windows.h>
#define HEIGHT 21
#define WIDTH 78
[Code]....
If you try and run it, it will give you a bug. But if you comment out the FindEntry function in the main it will work and look like this:
View 7 Replies
View Related
Apr 28, 2012
How can i come up with a program that uses entered radius of a circle to find its area
View 1 Replies
View Related
Jun 22, 2013
Any class or library that can to calculate the center and radius of a sphere from 4 known points on its surface?
View 9 Replies
View Related
Apr 10, 2013
I'm getting a error on my Circle::Circle(double radiusValue) constructor. My instructions is 'Add a constructor that accepts one argument and uses it to set the radius.'
#include <iostream>
#include <cmath>
using namespace std;
class Circle {
private:
double x;
double y;
double radius;
[Code] .....
View 3 Replies
View Related
Feb 14, 2014
Exerted by the rider's foot yet not exceed the stress placed on the crank arm's sprocket attachment, is provided by this formua:
r^3 = d*p/s*π
r is the radius of the cylindrical rod in inches. d is the length of the crank arm in inches. P is the weight placed on the pedal in lbs. S is the stress in lbs/in2
Using this information, design, write, compile, and execute a C++ program that computes the value of r for a crank arm that is 7 inches long, accommodates a maximum weight of 300 lbs, and is able to sustain a stress of 10,000 lbs/in2.
View 1 Replies
View Related
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
Apr 19, 2014
i'm working on a robotics project, to move the robot from it's current position to target position i need to calculate the angle first before i can move the robot.this the code I use to calculate the angle:
double cal_angle ( int current_x , int current_y , int tar_x , int tar_y )
{
return atan2(tar_y - current_y, tar_x - current_x);
}
int main ()
[code]....
as u can see the angle between x4,y4 to x1,y1 should be 3.14 (180)however , the result are correct as long as the distance from the current position to target position > 1 (not sure actually).
View 2 Replies
View Related
Feb 20, 2014
My question is not in c++ programing , but because my aim is to make code that calculate the three angles between two vector i ask my question here
So as the title i have three point that create two vector and I want to get the angles in x,y and z of the point2
I used crosproduct that give me one angle without axe , I don't know in which axe this angle
My aim is the three angles for the 3 axes ....
View 7 Replies
View Related
Nov 10, 2013
I am making a game and I am trying to rotate an image so that it is always pointing at the player. I have two lines, the first point of both of them is on the image and the second point of one line is on the last position of the player, and the second point of the other one is on the current position of the player. To rotate the image I need to get the angle between the two lines. how I can get that angle with only the points from the lines?
View 7 Replies
View Related
Jun 30, 2014
I'm trying to make a bullet bounce after it hits a wall. I think bouncing on the top and bottom wall works perfectly, but it won't bounce off of the left and right walls. How would I get it to bounce? This is how I get the direction the bullet it going whenever I shoot.
player.dir = GetAngle(player.mouseX, player.mouseY, player.x, player.y);
float GetAngle(float x1, float y1, float x2, float y2) {
return atan2(y1 - y2, x1 - x2);
}
Also what I was trying to do to make the bullet bounce.
if (bullets[i].x < 10 || bullets[i].x > screenWidth - 10 ||
bullets[i].y < 10 || bullets[i].y > screenHeight - 10) {
if (bullets[i].type == 8)
bullets[i].dir *= -1;
}
View 3 Replies
View Related
Dec 7, 2014
On a right angled triangle, if the user inputs only ONE side length (not the hypotenuse) and only ONE angle, what code is required to work out the hypotenuse? I know how to work out the final side and the remaining angle once I have this.
View 4 Replies
View Related
Apr 25, 2012
I developed this simple sample program to test cos():
Code:
#include <cmath>
#include <iostream>
using namespace std;
int main() {
const float radiansToDegrees = 180.0f / 3.141592653589793f;
float c = sqrt(2.0f);
float a = 1;
float angleRadians = cos(a/c);
float angle = radiansToDegrees*angleRadians;
}
I expected angle to be 45 exactly, but it's value is: angle = 43.558804
Why is the angle not 45 degrees? What did I do wrong?
View 4 Replies
View Related
Mar 17, 2014
I want to use an accelerometer to simply light up an LED at a certain angle. I want to use all three axis each corresponding to a different LED.
I am however getting no change in the LEDs. My code is below.
Code:
#pragma config FOSC = INTIO67, FCMEN = OFF, IESO = OFF // CONFIG1H
#pragma config PWRT = OFF, BOREN = SBORDIS, BORV = 30 // CONFIG2L
#pragma config WDTEN = OFF, WDTPS = 32768 // CONFIG2H
#pragma config MCLRE = OFF, LPT1OSC = OFF, PBADEN = ON, CCP2MX = PORTC // CONFIG3H
#pragma config STVREN = ON, LVP = OFF, XINST = OFF // CONFIG4L
[Code]...
View 6 Replies
View Related
Apr 16, 2012
In a cartesian coordinate system, I want to be able to predict a compass angle of an object. So I have a base position of (0,0) and then a distance and compass angle to an object. This object also has a heading and a speed. How can I predict the new compass angle of the object with that information?
my coordinate system is like this:
Code:
0 y
|
|
270-------------- 90 x
|
|
180
I think the first step would be to compute the cartesian coordinates of the object:
float degs_to_rads = 3.141592653589793 / 180.0;
x = distance * sin(angle*degs_to_rads);
y = distance * cos(angle*degs_to_rads);
then the next step would be to compute the predicted x and y from the speed and heading of the object:
predictedx = ??
predictedy = ??
then finally convert back to an angle, and distance:
newDistance = sqrt(predictedx^2 + predictedy^2);
newAngle = atan2(predictedy, predictedx);
fill in the blanks?? Are my other things correct?
View 10 Replies
View Related
Jul 24, 2013
This is an assignment which the purpose is to calculate an angle value in form of trigonometric functions. These are the codes that I've wrote so far.
#include <iostream>
#include <cstdlib>
using namespace std;
void menu(double &value) {
system("cls");
cout<<"*****Trigonometry Program*****"<<endl;
[Code] ....
I have completed the codes for the interface part. Before I proceed with the formula for the trigonometric functions, I would like to make sure the program is Error-free, which if there is accidental invalid input from the user, the program would the user to enter another input until it is a valid response.
The only problem I have encountered for this matter was in menu(value)
If I enter an integer, the program will proceed without error. However, If I enter a character, the program will slip into an endless loop which constantly shows this
*****Trigonometry Program*****
Please enter an angle value => Is the angle in Degree or Radian?
Type D if it is in Degree
Type R if it is in Radian
Your response=> 0 //my initial input for value
Do you want to continue?
Type Y to continue
Type any other key to stop
Your response =>
Where is the source of the problem? I'm pretty sure it's the loop, but I don't know what to do.
View 2 Replies
View Related
Sep 22, 2013
I want to make an object, which moves from x1,y1 to x2,y2 in a straight line, also make a sinus over the line (so the x,0 is the line itself, and cux,cury is the object. So the object will move as a sinus over the line. How do I do this in c++?
View 3 Replies
View Related
Apr 15, 2014
I'm making this program to mess with people and make them think its a virus.
#define _WIN32_WINNT 0x0500 //For hiding your console
#include <cstdlib>
#include <iostream>
#include <Windows.h>
#include <WinBase.h>
[Code]....
At line 42 and 43 I want to make the cursor move around in a circle over and over again but I'm not sure how.
View 4 Replies
View Related
Mar 22, 2013
I was given an assignment for class to calculate the area of a circle using only the radius as a user input and not using Pi in the code. I need to do this by calculating the areas of a series of rectangles under the curve and adding them together. Using nested loops to continuously reduce the size of these rectangles until the approximated area value is within a margin of error less than 0.1%.
Code:
#include<iostream>
#include<cmath>
using namespace std;
int main ()
[Code] .....
View 7 Replies
View Related