This program is meant to help you get practice with writing programs to perform more complex numerical calculations, and specifically to give you practice with vector calculations.   Write a program that calculates the angle between two points, as seen by an observer. Your program should read in: The 3D position of an observer The 3D position of the first observed point The 3D position of the second observed point Then, it should calculate and output, in degrees, the angle between the points from the viewer’s perspective.  The steps for doing this are: Read in the points from the user. Assume the points will be some (x, y, z) coordinates.  Calculate the two vectors from the observer to each of the observed points Normalize the vectors Calculate the dot product between the vectors Use that to calculate the angle between the two observed points. Note that the dot product of two normalized vectors gives the cosine of the angle between those vectors. Outputs the answer in degrees Before beginning coding, you should stop and think briefly about the variables you will need for your program. Use values in example below to check your program correctness.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

This program is meant to help you get practice with writing programs to perform more complex numerical calculations, and specifically to give you practice with vector calculations.

 

Write a program that calculates the angle between two points, as seen by an observer.

Your program should read in:

  • The 3D position of an observer
  • The 3D position of the first observed point
  • The 3D position of the second observed point

Then, it should calculate and output, in degrees, the angle between the points from the viewer’s perspective.  The steps for doing this are:

  • Read in the points from the user. Assume the points will be some (x, y, z) coordinates. 
  • Calculate the two vectors from the observer to each of the observed points
  • Normalize the vectors
  • Calculate the dot product between the vectors
  • Use that to calculate the angle between the two observed points. Note that the dot product of two normalized vectors gives the cosine of the angle between those vectors.
  • Outputs the answer in degrees

Before beginning coding, you should stop and think briefly about the variables you will need for your program.

Use values in example below to check your program correctness.

Help: https://www.analyzemath.com/stepbystep_mathworksheets/vectors/vector3D_angle.html

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education