Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7851091
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T19:04:48+00:00 2026-06-02T19:04:48+00:00

I have trouble understanding what’s wrong with my code. Point A = new Point((int)CENTER_X,

  • 0

I have trouble understanding what’s wrong with my code.

Point A = new Point((int)CENTER_X, (int)CENTER_Y);
Point B = new Point((int)me.getX(), (int)me.getY());
Point C = new Point((int)CENTER_X, (int)B.y);
double AB;
double AC;
double BC;
AB = Math.sqrt(Math.pow(B.x - A.x, 2) + Math.pow(B.y - A.y, 2));
AC = Math.sqrt(Math.pow(C.x - A.x, 2) + Math.pow(C.y - A.y, 2));
BC = Math.sqrt(Math.pow(C.x - B.x, 2) + Math.pow(C.y - B.y, 2));
degre = (AB * AB - AC * AC - BC * BC) /( 2 * AC * AB);
degre = Math.acos(degre*(180/Math.PI));

I am always getting degre = 0 or NaN. Why is that ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T19:04:51+00:00Added an answer on June 2, 2026 at 7:04 pm

    You are confused about when to do the radian to degree translation, you need to calculate the ratio, then do the arccos (which will return an angle in radians), then convert to degrees like so:

    double float ratio = (AB * AB + AC * AC - BC * BC) /( 2 * AC * AB);
    degre = Math.acos(ratio)*(180/Math.PI);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some trouble understanding the output from the following code: int main(void) {
Im new to obj-c and have trouble understanding the function autorelease. could someone explain
I have trouble understanding this chunk of code: let sieve (p:xs) = p :
I have trouble understanding the compilers. The following code does work in UNIX under
I have trouble understanding what the following code means (and partly, why it even
I am new to iOS5 development and using objective-c. I have trouble understanding the
I'm new to CMake and have trouble understanding some usage concepts. I'm calling a
I have trouble understanding the underlying errors with the code below: class myClass {
I have been looking at this code and I am having trouble understanding the
The idea of MVC itself seems clear to me but I have trouble understanding

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.