Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

HINT: Your functions will have to pass arrays back and forth. A pointer argument may also be necessary for the angle between the two vectors.

image text in transcribed

HINT:

Your functions will have to pass arrays back and forth. A pointer argument may also be necessary for the angle between the two vectors. Write a C program that prompts the user to choose between the following options

M for vector magnitude. This option prompts the user to enter in a single 3-D vector.

D for dot product. This option prompts the user to enter in two 3-D vectors.

C for cross product. This option prompts the user to enter in two 3-D vectors.

Print the output of the appropriate calculations to the screen.

2 Vector Calculations We wish to write a set of C functions to work with 3-D vectors. Write C functions as follows: VectorMagnitude -Input: An array that represents a 3-D vector V-(V, V, VJ -Output: The magnitude of the input vector |v-VV2 + + DotProduct Input: Two arrays of three elements each, that represent vectors , and -Output!: The dot product of these two vectors Vi .= i * 2 + *2 + 1 * V,2 v ) 180). Note that this calculation Output2: The angle between the two vectors (in degrees) cos 1 must call the function VectorMagnitude twice CrossProduct Input: Two arrays of three elements each, that represent vectors V1 and -Output 1: A 3-element array that represents the cross product of the two input vectors. The cross product is described below - Output2: The angle between the two input vectors (in degrees). The method for calculating the angle between the two input vectors, using the cross product is described below The cross product of two vectors is defined as the formal determinant of the following matrix U2 y2 The cross product can be used to find the angle between two vectors 180 3 where V's V1 V Note that this calculation requires three calls to Vector/agnitude. Also note that the value inside the parenthesis of the sin-1 function might need limiting between 1

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional Visual Basic 6 Databases

Authors: Charles Williams

1st Edition

1861002025, 978-1861002020

More Books

Students also viewed these Databases questions