|
I`m doing something wrong. In a right triangle the hypotenuse length is 80.62 the triangle side length opposing the angle is 40. The windows calculator result for inverse sin 40/80.6225 is 29.74 When I do the math with asinf() I`m getting 0.519
|
|
|
|
|
Post your code, then.
The following program
#include <cmath>
#include <iostream>
using namespace std;
int main()
{
double angle = asin( 40/80.6225 );
cout << "angle " << angle << " (" << (angle * 180 / M_PI) << " degrees)" << endl;
} Outputs
angle 0.519147 (29.7449 degrees)
|
|
|
|
|
after conversion the result is as it should be , thanks
|
|
|
|
|
|
You probably mix degrees with radians.
|
|
|
|
|
|
I`m working on several things at the same time. Don`t go wandering if I`m active simultaneously in two threads.
Quote: That is you get the first quadrant angle correnspondig to the sin value passed as argument.
What`s the formula when you want work with remaining quadrants? This formula doesn`t work always.
|
|
|
|
|
You have to use the atan2[^] function.
|
|
|
|
|
|
|
I have my object rotation algorithm working though it will only rotate 180 degrees atm. It`s an algorithm that handles object rotations without matrices.
modified 12-Apr-20 12:58pm.
|
|
|
|
|
Hello Everyone,
I am using libpng library for generating PNG files which is working fine. But it always generating with DPI 96 by default.
I tried using png_set_pHYs for setting the resolution before calling png_write_png. But its not generating with the specified DPI.
Before and after calling png_set_pHYs, i am checking the DPI using png_get_pHYs, it was showing the correct values whatever i set.
What may be the issue? And is that possible to set DPI for PNG file?
Please suggest.
Regards,
Gopinath.
|
|
|
|
|
Gopi Nath wrote: What may be the issue? Without the source code of the library it is impossible to guess.
|
|
|
|
|
That's the problem. they didn't provide source code nowhere.
|
|
|
|
|
Well you cannot expect anyone here to be able to guess what the code does. Try asking the people who produced the library.
|
|
|
|
|
Hi all,
I'm writing a C++ class for my company and I finished all the explanation parts. Now I need to intersperse both examples, mostly detailing differences of implementation of basic functionalities between C and C++, and exercises to give the trainees (freshly graduated).
I need them to be an inspiration for me, not going to copy/paste them shamelessly, since I'm going to illustrate the points I've made in the course. Also they will be in powerpoint so I will need to trim them quite a bit.
If you know sources you trust for this kind of content you would help me a lot (yes, I will search with my Google-fu but your knowledge, training, experience and Google-jitsu may help me nevertheless).
Thanks.
GCS d--(d+) s-/++ a C++++ U+++ P- L+@ E-- W++ N+ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- r+++ y+++* Weapons extension: ma- k++ F+2 X
|
|
|
|
|
|
Microsoft C++ samples are overly complex for an introductory course which has to cram C++ in 8 hours, on powerpoint slides, to students who just got out of college.
I will take a good look at them anyway, thanks!
GCS d--(d+) s-/++ a C++++ U+++ P- L+@ E-- W++ N+ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- r+++ y+++* Weapons extension: ma- k++ F+2 X
|
|
|
|
|
The alternative (and very time consuming) is to go through the list of library/standard template library functions and take the sample code from each. But it all rather depends on exactly what you want to teach them.
|
|
|
|
|
|
den2k88 wrote: I'm writing a C++ class... When I first read that, I thought you were writing a C++ class, and thus the rest of your message made no sense.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
Oh thank goodness. Now it all makes sense. I wonder how many others here parsed it the same way.
Keep Calm and Carry On
|
|
|
|
|
Personally you are doing it all backwards you give new graduates the company programming rules and guidelines and tell them what happens if they submit junk that doesn't conform ... which usually involves buying rounds of beers.
They will have a pile of bad habits and completely unacceptable risks they picked up at uni and thought was cool and some are just dam lazy.
Then you get them to try and write a simple program that conforms and discuss the errors and violations they will without doubt submit.
Trust me there will be as many different coding styles as you have graduates and somehow you have to get them all to be able to read each others code as well as you. You aren't trying to stifle thinking and coding imagination but you need to get them on the same pages with standards.
As for examples... Rosetta Code has hundreds
Category:C - Rosetta Code[^]
In vino veritas
modified 2-Apr-20 11:27am.
|
|
|
|
|
They don't know C++ at all, just the basics of C without any practical programming with the exception of the laboratories and exams (of course there are exceptions, one or two each batch of 30).
Most of them rarely used a compiler, coding rules are way bove their head.
GCS d--(d+) s-/++ a C++++ U+++ P- L+@ E-- W++ N+ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- r+++ y+++* Weapons extension: ma- k++ F+2 X
|
|
|
|
|
den2k88 wrote: Most of them rarely used a compiler More recruits to QA
|
|
|
|