Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C$210-Machine Problem 6 Vector Library 20 Points March 22,2018 Your task is to implement a brary for handling 3-d vector arithmetic. For this project, you

image text in transcribed
C$210-Machine Problem 6 Vector Library 20 Points March 22,2018 Your task is to implement a brary for handling 3-d vector arithmetic. For this project, you will not submit a main.c fle, you will simply submit the vector c and vecter files in a single aip my driver program to test your implementation le. I will nun Specifications The type of vectors should be called vector t It should have three doubleprecison components named x, y, and . You must provide a function vector t make, vector (double s. double . double a) that takes three double arguments representing the components of a vector and returns a vector.. You must provide a function vold vec2a(vector,t v, char reault)that puts a string represen- tation of x into the string reault. The format should be: a.. with no spaces and three places past the decimal point. (e.g. . You must provide functions for the following arithmetic operations: vec add that takes two vectors and returns their sum. vec aub that takes two vectors and returns their difference. - vec,scale that takes a vector and a double and returns the vector multiplied by the double. - vec_dot that takes two vectors and returns a double which is their dot product - vec_cross that takes two vectors and returns a vector that is their cross product vec_aagnitude that takes a vector and returns its magnitude (as a double). -vec unitvector that takes a vector and returns a unit vector with the same direction as argu ment. - vec unitnormal that takes two vectors and returns a unit vector that is orthogonal to both of them. (Hint: The cross product of two vectors is orthogonal to both of them) You may use the following formulae: sprintf (str ) %d

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

SQL Antipatterns Avoiding The Pitfalls Of Database Programming

Authors: Bill Karwin

1st Edition

1680508989, 978-1680508987

More Books

Students also viewed these Databases questions