Calculation of the volume and surface of a cuboïd knowing the coordinates of two opposite vertices

973 Views Asked by At

I hope someone will help me with this problem i'm facing right now. So our C language teacher gives us an exercice to solve. The exercice itself looks easy and the programmation part is not the problem. So he did ask us to calculate the volume, surface and the total length of all edges of a cuboïd just knowing the coordinates of two vertices (those forming the space diagonal). I did my research on internet to find the mathematic formulas to calculate what i need here but apparently with just two vertices it's not possible. Now i'm confused i don't know if our teacher did forget to give another details or am i missing something big right here i really don't know! please can anyone here help. Thank you in advance :)

Here is the complete Exercice:

Task 3: Cuboid Calculations

A cuboid is represented by two of its vertices in three-dimensional space, as follow:

The Cuboïd with the two vertices(forming a space diagonal)

Write a C program that reads the coordinates of the two vertices from the screen (the coordinates of the two vertices will be given by the user of the programm) and then calculates the following figures and outputs them on the screen:

  • Volume
  • Surface
  • Total length of all edges
2

There are 2 best solutions below

3
On BEST ANSWER

The edges of cuboid are parallel to the coordinate axes.

$$ x_2-x_1= L;\quad y_2-y_1= B; \quad z_2-z_1 = H; $$

$$ V= LBH; \quad A = 2 (LB+BH +HL). $$

0
On

The problem is not completely self-explanatory, but one interpretation that would make it possible to solve the problem is if we assume that the edges of the cuboid are parallel to the $x,$ $y,$ and $z$ axes. (The edges in the illustration certainly look like they could be parallel to the axes according to one of the typical ways to draw the axes of a three-dimensional Cartesian space.)

Under this interpretation of the problem, you know that all four vertices on the "bottom" face of the cuboid have $z$-coordinate equal to $z_1$ while all four vertices on the "top" face of the cuboid have $z$-coordinate equal to $z_2.$ You can similarly figure out the $x$ and $y$ coordinates of all vertices.

With all of that information, the volume, surface area, and total lengths of all edges are completely determined.

I see no other interpretation that makes this problem solvable, so it seems smart to guess that this interpretation is what the person posing the problem had in mind.