mirror of
https://github.com/BelfrySCAD/BOSL2.git
synced 2026-02-07 20:49:19 +00:00
Merge 6c5bf83f67 into 9c98242faf
This commit is contained in:
commit
31605448c3
1 changed files with 201 additions and 51 deletions
|
|
@ -120,13 +120,11 @@ function law_of_sines(a, A, b, B) =
|
|||
|
||||
|
||||
// Function: hyp_opp_to_adj()
|
||||
// Alias: opp_hyp_to_adj()
|
||||
// Synopsis: Returns the adjacent side length from the lengths of the hypotenuse and the opposite side.
|
||||
// Topics: Geometry, Trigonometry, Triangles
|
||||
// See Also: adj_ang_to_hyp(), adj_ang_to_opp(), adj_opp_to_ang(), adj_opp_to_hyp(), hyp_adj_to_ang(), hyp_adj_to_opp(), hyp_ang_to_adj(), hyp_ang_to_opp(), hyp_opp_to_adj(), hyp_opp_to_ang(), opp_ang_to_adj(), opp_ang_to_hyp()
|
||||
// See Also: adj_ang_to_hyp(), adj_ang_to_opp(), adj_opp_to_ang(), adj_opp_to_hyp(), hyp_adj_to_ang(), hyp_adj_to_opp(), hyp_ang_to_adj(), hyp_ang_to_opp(), hyp_opp_to_adj(), hyp_opp_to_ang(), opp_ang_to_adj(), opp_ang_to_hyp(), ang_adj_to_hyp(), ang_adj_to_opp(), opp_adj_to_ang(), opp_adj_to_hyp(), adj_hyp_to_ang(), adj_hyp_to_opp(), ang_hyp_to_adj(), ang_hyp_to_opp(), opp_hyp_to_adj(), opp_hyp_to_ang(), ang_opp_to_adj(), ang_opp_to_hyp()
|
||||
// Usage:
|
||||
// adj = hyp_opp_to_adj(hyp,opp);
|
||||
// adj = opp_hyp_to_adj(opp,hyp);
|
||||
// Description:
|
||||
// Given the lengths of the hypotenuse and opposite side of a right triangle, returns the length
|
||||
// of the adjacent side.
|
||||
|
|
@ -134,23 +132,36 @@ function law_of_sines(a, A, b, B) =
|
|||
// hyp = The length of the hypotenuse of the right triangle.
|
||||
// opp = The length of the side of the right triangle that is opposite from the primary angle.
|
||||
// Example:
|
||||
// hyp = hyp_opp_to_adj(5,3); // Returns: 4
|
||||
// adj = hyp_opp_to_adj(5,3); // Returns: 4
|
||||
function hyp_opp_to_adj(hyp,opp) =
|
||||
assert(is_finite(hyp+opp) && hyp>=0 && opp>=0,
|
||||
"Triangle side lengths should be a positive numbers." )
|
||||
sqrt(hyp*hyp-opp*opp);
|
||||
|
||||
|
||||
// Function: opp_hyp_to_adj()
|
||||
// Synopsis: Returns the adjacent side length from the lengths of the hypotenuse and the opposite side.
|
||||
// Topics: Geometry, Trigonometry, Triangles
|
||||
// See Also: adj_ang_to_hyp(), adj_ang_to_opp(), adj_opp_to_ang(), adj_opp_to_hyp(), hyp_adj_to_ang(), hyp_adj_to_opp(), hyp_ang_to_adj(), hyp_ang_to_opp(), hyp_opp_to_adj(), hyp_opp_to_ang(), opp_ang_to_adj(), opp_ang_to_hyp(), ang_adj_to_hyp(), ang_adj_to_opp(), opp_adj_to_ang(), opp_adj_to_hyp(), adj_hyp_to_ang(), adj_hyp_to_opp(), ang_hyp_to_adj(), ang_hyp_to_opp(), opp_hyp_to_adj(), opp_hyp_to_ang(), ang_opp_to_adj(), ang_opp_to_hyp()
|
||||
// Usage:
|
||||
// adj = opp_hyp_to_adj(opp,hyp);
|
||||
// Description:
|
||||
// Given the lengths of the opposite side and hypotenuse of a right triangle, returns the length
|
||||
// of the adjacent side.
|
||||
// Arguments:
|
||||
// opp = The length of the side of the right triangle that is opposite from the primary angle.
|
||||
// hyp = The length of the hypotenuse of the right triangle.
|
||||
// Example:
|
||||
// adj = opp_hyp_to_adj(3,5); // Returns: 4
|
||||
function opp_hyp_to_adj(opp,hyp) = hyp_opp_to_adj(hyp,opp);
|
||||
|
||||
|
||||
// Function: hyp_ang_to_adj()
|
||||
// Alias: ang_hyp_to_adj()
|
||||
// Synopsis: Returns the adjacent side length from the length of the hypotenuse and the angle.
|
||||
// Topics: Geometry, Trigonometry, Triangles
|
||||
// See Also: adj_ang_to_hyp(), adj_ang_to_opp(), adj_opp_to_ang(), adj_opp_to_hyp(), hyp_adj_to_ang(), hyp_adj_to_opp(), hyp_ang_to_adj(), hyp_ang_to_opp(), hyp_opp_to_adj(), hyp_opp_to_ang(), opp_ang_to_adj(), opp_ang_to_hyp()
|
||||
// See Also: adj_ang_to_hyp(), adj_ang_to_opp(), adj_opp_to_ang(), adj_opp_to_hyp(), hyp_adj_to_ang(), hyp_adj_to_opp(), hyp_ang_to_adj(), hyp_ang_to_opp(), hyp_opp_to_adj(), hyp_opp_to_ang(), opp_ang_to_adj(), opp_ang_to_hyp(), ang_adj_to_hyp(), ang_adj_to_opp(), opp_adj_to_ang(), opp_adj_to_hyp(), adj_hyp_to_ang(), adj_hyp_to_opp(), ang_hyp_to_adj(), ang_hyp_to_opp(), opp_hyp_to_adj(), opp_hyp_to_ang(), ang_opp_to_adj(), ang_opp_to_hyp()
|
||||
// Usage:
|
||||
// adj = hyp_ang_to_adj(hyp,ang);
|
||||
// adj = ang_hyp_to_adj(ang,hyp);
|
||||
// Description:
|
||||
// Given the length of the hypotenuse and the angle of the primary corner of a right triangle,
|
||||
// returns the length of the adjacent side.
|
||||
|
|
@ -164,43 +175,67 @@ function hyp_ang_to_adj(hyp,ang) =
|
|||
assert(is_finite(ang) && ang>-90 && ang<90, "The angle should be an acute angle." )
|
||||
hyp*cos(ang);
|
||||
|
||||
// Function: ang_hyp_to_adj()
|
||||
// Synopsis: Returns the adjacent side length from the angle and the length of the hypotenuse.
|
||||
// Topics: Geometry, Trigonometry, Triangles
|
||||
// See Also: adj_ang_to_hyp(), adj_ang_to_opp(), adj_opp_to_ang(), adj_opp_to_hyp(), hyp_adj_to_ang(), hyp_adj_to_opp(), hyp_ang_to_adj(), hyp_ang_to_opp(), hyp_opp_to_adj(), hyp_opp_to_ang(), opp_ang_to_adj(), opp_ang_to_hyp(), ang_adj_to_hyp(), ang_adj_to_opp(), opp_adj_to_ang(), opp_adj_to_hyp(), adj_hyp_to_ang(), adj_hyp_to_opp(), ang_hyp_to_adj(), ang_hyp_to_opp(), opp_hyp_to_adj(), opp_hyp_to_ang(), ang_opp_to_adj(), ang_opp_to_hyp()
|
||||
// Usage:
|
||||
// adj = ang_hyp_to_adj(ang,hyp);
|
||||
// Description:
|
||||
// Given the angle of the primary corner and the length of the hypotenuse of a right triangle,
|
||||
// returns the length of the adjacent side.
|
||||
// Arguments:
|
||||
// ang = The angle in degrees of the primary corner of the right triangle.
|
||||
// hyp = The length of the hypotenuse of the right triangle.
|
||||
// Example:
|
||||
// adj = ang_hyp_to_adj(60,8); // Returns: 4
|
||||
function ang_hyp_to_adj(ang,hyp) = hyp_ang_to_adj(hyp, ang);
|
||||
|
||||
|
||||
// Function: opp_ang_to_adj()
|
||||
// Alias: ang_opp_to_adj()
|
||||
// Synopsis: Returns the adjacent side length from the length of the opposite side and the angle.
|
||||
// Synopsis: Returns the adjacent side length from the length of the opposite side and the primary angle.
|
||||
// Topics: Geometry, Trigonometry, Triangles
|
||||
// See Also: adj_ang_to_hyp(), adj_ang_to_opp(), adj_opp_to_ang(), adj_opp_to_hyp(), hyp_adj_to_ang(), hyp_adj_to_opp(), hyp_ang_to_adj(), hyp_ang_to_opp(), hyp_opp_to_adj(), hyp_opp_to_ang(), opp_ang_to_adj(), opp_ang_to_hyp()
|
||||
// See Also: adj_ang_to_hyp(), adj_ang_to_opp(), adj_opp_to_ang(), adj_opp_to_hyp(), hyp_adj_to_ang(), hyp_adj_to_opp(), hyp_ang_to_adj(), hyp_ang_to_opp(), hyp_opp_to_adj(), hyp_opp_to_ang(), opp_ang_to_adj(), opp_ang_to_hyp(), ang_adj_to_hyp(), ang_adj_to_opp(), opp_adj_to_ang(), opp_adj_to_hyp(), adj_hyp_to_ang(), adj_hyp_to_opp(), ang_hyp_to_adj(), ang_hyp_to_opp(), opp_hyp_to_adj(), opp_hyp_to_ang(), ang_opp_to_adj(), ang_opp_to_hyp()
|
||||
// Usage:
|
||||
// adj = opp_ang_to_adj(opp,ang);
|
||||
// adj = ang_opp_to_adj(ang,opp);
|
||||
// Description:
|
||||
// Given the angle of the primary corner of a right triangle, and the length of the side opposite of it,
|
||||
// Given the length of the side opposite the primary corner, and the angle of the primary corner of a right triangle,
|
||||
// returns the length of the adjacent side.
|
||||
// Arguments:
|
||||
// opp = The length of the side of the right triangle that is opposite from the primary angle.
|
||||
// ang = The angle in degrees of the primary corner of the right triangle.
|
||||
// Example:
|
||||
// adj = opp_ang_to_adj(8,30); // Returns: 4
|
||||
// adj = opp_ang_to_adj(8,45); // Returns: 8
|
||||
function opp_ang_to_adj(opp,ang) =
|
||||
assert(is_finite(opp) && opp>=0, "Triangle side length should be a positive number." )
|
||||
assert(is_finite(ang) && ang>-90 && ang<90, "The angle should be an acute angle." )
|
||||
opp/tan(ang);
|
||||
|
||||
// Function: ang_opp_to_adj()
|
||||
// Synopsis: Returns the adjacent side length from the primary angle and the length of the opposite side.
|
||||
// Topics: Geometry, Trigonometry, Triangles
|
||||
// See Also: adj_ang_to_hyp(), adj_ang_to_opp(), adj_opp_to_ang(), adj_opp_to_hyp(), hyp_adj_to_ang(), hyp_adj_to_opp(), hyp_ang_to_adj(), hyp_ang_to_opp(), hyp_opp_to_adj(), hyp_opp_to_ang(), opp_ang_to_adj(), opp_ang_to_hyp(), ang_adj_to_hyp(), ang_adj_to_opp(), opp_adj_to_ang(), opp_adj_to_hyp(), adj_hyp_to_ang(), adj_hyp_to_opp(), ang_hyp_to_adj(), ang_hyp_to_opp(), opp_hyp_to_adj(), opp_hyp_to_ang(), ang_opp_to_adj(), ang_opp_to_hyp()
|
||||
// Usage:
|
||||
// adj = ang_opp_to_adj(ang,opp);
|
||||
// Description:
|
||||
// Given the angle of the primary corner of a right triangle, and the length of the side opposite of it,
|
||||
// returns the length of the adjacent side.
|
||||
// Arguments:
|
||||
// ang = The angle in degrees of the primary corner of the right triangle.
|
||||
// opp = The length of the side of the right triangle that is opposite from the primary angle.
|
||||
// Example:
|
||||
// adj = ang_opp_to_adj(45,8); // Returns: 8
|
||||
function ang_opp_to_adj(ang,opp) = opp_ang_to_adj(opp,ang);
|
||||
|
||||
|
||||
// Function: hyp_adj_to_opp()
|
||||
// Alias: adj_hyp_to_opp()
|
||||
// Synopsis: Returns the opposite side length from the lengths of the hypotenuse and the adjacent side.
|
||||
// Topics: Geometry, Trigonometry, Triangles
|
||||
// See Also: adj_ang_to_hyp(), adj_ang_to_opp(), adj_opp_to_ang(), adj_opp_to_hyp(), hyp_adj_to_ang(), hyp_adj_to_opp(), hyp_ang_to_adj(), hyp_ang_to_opp(), hyp_opp_to_adj(), hyp_opp_to_ang(), opp_ang_to_adj(), opp_ang_to_hyp()
|
||||
// See Also: adj_ang_to_hyp(), adj_ang_to_opp(), adj_opp_to_ang(), adj_opp_to_hyp(), hyp_adj_to_ang(), hyp_adj_to_opp(), hyp_ang_to_adj(), hyp_ang_to_opp(), hyp_opp_to_adj(), hyp_opp_to_ang(), opp_ang_to_adj(), opp_ang_to_hyp(), ang_adj_to_hyp(), ang_adj_to_opp(), opp_adj_to_ang(), opp_adj_to_hyp(), adj_hyp_to_ang(), adj_hyp_to_opp(), ang_hyp_to_adj(), ang_hyp_to_opp(), opp_hyp_to_adj(), opp_hyp_to_ang(), ang_opp_to_adj(), ang_opp_to_hyp()
|
||||
// Usage:
|
||||
// opp = hyp_adj_to_opp(hyp,adj);
|
||||
// opp = adj_hyp_to_opp(adj,hyp);
|
||||
// Description:
|
||||
// Given the length of the hypotenuse and the adjacent side, returns the length of the opposite side.
|
||||
// Given the lengths of the hypotenuse and the adjacent side, returns the length of the opposite side.
|
||||
// Arguments:
|
||||
// hyp = The length of the hypotenuse of the right triangle.
|
||||
// adj = The length of the side of the right triangle that is adjacent to the primary angle.
|
||||
|
|
@ -211,19 +246,34 @@ function hyp_adj_to_opp(hyp,adj) =
|
|||
"Triangle side lengths should be a positive numbers." )
|
||||
sqrt(hyp*hyp-adj*adj);
|
||||
|
||||
|
||||
|
||||
// Function: adj_hyp_to_opp()
|
||||
// Synopsis: Returns the opposite side length from the lengths of the adjacent side and the hypotenuse.
|
||||
// Topics: Geometry, Trigonometry, Triangles
|
||||
// See Also: adj_ang_to_hyp(), adj_ang_to_opp(), adj_opp_to_ang(), adj_opp_to_hyp(), hyp_adj_to_ang(), hyp_adj_to_opp(), hyp_ang_to_adj(), hyp_ang_to_opp(), hyp_opp_to_adj(), hyp_opp_to_ang(), opp_ang_to_adj(), opp_ang_to_hyp(), ang_adj_to_hyp(), ang_adj_to_opp(), opp_adj_to_ang(), opp_adj_to_hyp(), adj_hyp_to_ang(), adj_hyp_to_opp(), ang_hyp_to_adj(), ang_hyp_to_opp(), opp_hyp_to_adj(), opp_hyp_to_ang(), ang_opp_to_adj(), ang_opp_to_hyp()
|
||||
// Usage:
|
||||
// opp = adj_hyp_to_opp(adj,hyp);
|
||||
// Description:
|
||||
// Given the lengths of the adjacent side and the hypotenuse, returns the length of the opposite side.
|
||||
// Arguments:
|
||||
// adj = The length of the side of the right triangle that is adjacent to the primary angle.
|
||||
// hyp = The length of the hypotenuse of the right triangle.
|
||||
// Example:
|
||||
// opp = adj_hyp_to_opp(4,5); // Returns: 3
|
||||
|
||||
function adj_hyp_to_opp(adj,hyp) = hyp_adj_to_opp(hyp,adj);
|
||||
|
||||
|
||||
|
||||
// Function: hyp_ang_to_opp()
|
||||
// Alias: ang_hyp_to_opp()
|
||||
// Synopsis: Returns the opposite side length from the length of the hypotenuse and the angle.
|
||||
// Synopsis: Returns the opposite side length from the length of the hypotenuse and the primary angle.
|
||||
// Topics: Geometry, Trigonometry, Triangles
|
||||
// See Also: adj_ang_to_hyp(), adj_ang_to_opp(), adj_opp_to_ang(), adj_opp_to_hyp(), hyp_adj_to_ang(), hyp_adj_to_opp(), hyp_ang_to_adj(), hyp_ang_to_opp(), hyp_opp_to_adj(), hyp_opp_to_ang(), opp_ang_to_adj(), opp_ang_to_hyp()
|
||||
// See Also: adj_ang_to_hyp(), adj_ang_to_opp(), adj_opp_to_ang(), adj_opp_to_hyp(), hyp_adj_to_ang(), hyp_adj_to_opp(), hyp_ang_to_adj(), hyp_ang_to_opp(), hyp_opp_to_adj(), hyp_opp_to_ang(), opp_ang_to_adj(), opp_ang_to_hyp(), ang_adj_to_hyp(), ang_adj_to_opp(), opp_adj_to_ang(), opp_adj_to_hyp(), adj_hyp_to_ang(), adj_hyp_to_opp(), ang_hyp_to_adj(), ang_hyp_to_opp(), opp_hyp_to_adj(), opp_hyp_to_ang(), ang_opp_to_adj(), ang_opp_to_hyp()
|
||||
// Usage:
|
||||
// opp = hyp_ang_to_opp(hyp,ang);
|
||||
// opp = ang_hyp_to_opp(ang,hyp);
|
||||
// Description:
|
||||
// Given the length of the hypotenuse of a right triangle, and the angle of the corner, returns the length of the opposite side.
|
||||
// Given the length of the hypotenuse of a right triangle and the angle of the primary corner, returns the length of the opposite side.
|
||||
// Arguments:
|
||||
// hyp = The length of the hypotenuse of the right triangle.
|
||||
// ang = The angle in degrees of the primary corner of the right triangle.
|
||||
|
|
@ -234,19 +284,31 @@ function hyp_ang_to_opp(hyp,ang) =
|
|||
assert(is_finite(ang) && ang>-90 && ang<90, "The angle should be an acute angle." )
|
||||
hyp*sin(ang);
|
||||
|
||||
|
||||
// Function: ang_hyp_to_opp()
|
||||
// Synopsis: Returns the opposite side length from the primary angle and the length of the hypotenuse.
|
||||
// Topics: Geometry, Trigonometry, Triangles
|
||||
// See Also: adj_ang_to_hyp(), adj_ang_to_opp(), adj_opp_to_ang(), adj_opp_to_hyp(), hyp_adj_to_ang(), hyp_adj_to_opp(), hyp_ang_to_adj(), hyp_ang_to_opp(), hyp_opp_to_adj(), hyp_opp_to_ang(), opp_ang_to_adj(), opp_ang_to_hyp(), ang_adj_to_hyp(), ang_adj_to_opp(), opp_adj_to_ang(), opp_adj_to_hyp(), adj_hyp_to_ang(), adj_hyp_to_opp(), ang_hyp_to_adj(), ang_hyp_to_opp(), opp_hyp_to_adj(), opp_hyp_to_ang(), ang_opp_to_adj(), ang_opp_to_hyp()
|
||||
// Usage:
|
||||
// opp = ang_hyp_to_opp(ang,hyp);
|
||||
// Description:
|
||||
// Given the the angle of the primary corner and the length of the hypotenuse of a right triangle, returns the length of the opposite side.
|
||||
// Arguments:
|
||||
// ang = The angle in degrees of the primary corner of the right triangle.
|
||||
// hyp = The length of the hypotenuse of the right triangle.
|
||||
// Example:
|
||||
// opp = ang_hyp_to_opp(30,8); // Returns: 4
|
||||
function ang_hyp_to_opp(ang,hyp) = hyp_ang_to_opp(hyp,ang);
|
||||
|
||||
|
||||
// Function: adj_ang_to_opp()
|
||||
// Alias: ang_adj_to_opp()
|
||||
// Synopsis: Returns the opposite side length from the length of the adjacent side and the angle.
|
||||
// Synopsis: Returns the opposite side length from the length of the adjacent side and the primary angle.
|
||||
// Topics: Geometry, Trigonometry, Triangles
|
||||
// See Also: adj_ang_to_hyp(), adj_ang_to_opp(), adj_opp_to_ang(), adj_opp_to_hyp(), hyp_adj_to_ang(), hyp_adj_to_opp(), hyp_ang_to_adj(), hyp_ang_to_opp(), hyp_opp_to_adj(), hyp_opp_to_ang(), opp_ang_to_adj(), opp_ang_to_hyp()
|
||||
// See Also: adj_ang_to_hyp(), adj_ang_to_opp(), adj_opp_to_ang(), adj_opp_to_hyp(), hyp_adj_to_ang(), hyp_adj_to_opp(), hyp_ang_to_adj(), hyp_ang_to_opp(), hyp_opp_to_adj(), hyp_opp_to_ang(), opp_ang_to_adj(), opp_ang_to_hyp(), ang_adj_to_hyp(), ang_adj_to_opp(), opp_adj_to_ang(), opp_adj_to_hyp(), adj_hyp_to_ang(), adj_hyp_to_opp(), ang_hyp_to_adj(), ang_hyp_to_opp(), opp_hyp_to_adj(), opp_hyp_to_ang(), ang_opp_to_adj(), ang_opp_to_hyp()
|
||||
// Usage:
|
||||
// opp = adj_ang_to_opp(adj,ang);
|
||||
// opp = ang_adj_to_opp(ang,adj);
|
||||
// Description:
|
||||
// Given the length of the adjacent side of a right triangle, and the angle of the corner, returns the length of the opposite side.
|
||||
// Given the length of the adjacent side of a right triangle, and the angle of the primary corner, returns the length of the opposite side.
|
||||
// Arguments:
|
||||
// adj = The length of the side of the right triangle that is adjacent to the primary angle.
|
||||
// ang = The angle in degrees of the primary corner of the right triangle.
|
||||
|
|
@ -257,17 +319,28 @@ function adj_ang_to_opp(adj,ang) =
|
|||
assert(is_finite(ang) && ang>-90 && ang<90, "The angle should be an acute angle." )
|
||||
adj*tan(ang);
|
||||
|
||||
// Function: ang_adj_to_opp()
|
||||
// Synopsis: Returns the opposite side length from the length of the adjacent side and the primary angle.
|
||||
// Topics: Geometry, Trigonometry, Triangles
|
||||
// See Also: adj_ang_to_hyp(), adj_ang_to_opp(), adj_opp_to_ang(), adj_opp_to_hyp(), hyp_adj_to_ang(), hyp_adj_to_opp(), hyp_ang_to_adj(), hyp_ang_to_opp(), hyp_opp_to_adj(), hyp_opp_to_ang(), opp_ang_to_adj(), opp_ang_to_hyp(), ang_adj_to_hyp(), ang_adj_to_opp(), opp_adj_to_ang(), opp_adj_to_hyp(), adj_hyp_to_ang(), adj_hyp_to_opp(), ang_hyp_to_adj(), ang_hyp_to_opp(), opp_hyp_to_adj(), opp_hyp_to_ang(), ang_opp_to_adj(), ang_opp_to_hyp()
|
||||
// Usage:
|
||||
// opp = ang_adj_to_opp(ang,adj);
|
||||
// Description:
|
||||
// Given the angle of the primary corner and the length of the adjacent side of a right triangle, returns the length of the opposite side.
|
||||
// Arguments:
|
||||
// ang = The angle in degrees of the primary corner of the right triangle.
|
||||
// adj = The length of the side of the right triangle that is adjacent to the primary angle.
|
||||
// Example:
|
||||
// opp = ang_adj_to_opp(45,8); // Returns: 8
|
||||
function ang_adj_to_opp(ang,adj) = adj_ang_to_opp(adj,ang);
|
||||
|
||||
|
||||
// Function: adj_opp_to_hyp()
|
||||
// Alias: opp_adj_to_hyp()
|
||||
// Synopsis: Returns the hypotenuse length from the lengths of the adjacent and opposite sides.
|
||||
// Topics: Geometry, Trigonometry, Triangles
|
||||
// See Also: adj_ang_to_hyp(), adj_ang_to_opp(), adj_opp_to_ang(), adj_opp_to_hyp(), hyp_adj_to_ang(), hyp_adj_to_opp(), hyp_ang_to_adj(), hyp_ang_to_opp(), hyp_opp_to_adj(), hyp_opp_to_ang(), opp_ang_to_adj(), opp_ang_to_hyp()
|
||||
// See Also: adj_ang_to_hyp(), adj_ang_to_opp(), adj_opp_to_ang(), adj_opp_to_hyp(), hyp_adj_to_ang(), hyp_adj_to_opp(), hyp_ang_to_adj(), hyp_ang_to_opp(), hyp_opp_to_adj(), hyp_opp_to_ang(), opp_ang_to_adj(), opp_ang_to_hyp(), ang_adj_to_hyp(), ang_adj_to_opp(), opp_adj_to_ang(), opp_adj_to_hyp(), adj_hyp_to_ang(), adj_hyp_to_opp(), ang_hyp_to_adj(), ang_hyp_to_opp(), opp_hyp_to_adj(), opp_hyp_to_ang(), ang_opp_to_adj(), ang_opp_to_hyp()
|
||||
// Usage:
|
||||
// hyp = adj_opp_to_hyp(adj,opp);
|
||||
// hyp = opp_adj_to_hyp(opp,adj);
|
||||
// Description:
|
||||
// Given the length of the adjacent and opposite sides of a right triangle, returns the length of the hypotenuse.
|
||||
// Arguments:
|
||||
|
|
@ -280,17 +353,29 @@ function adj_opp_to_hyp(adj,opp) =
|
|||
"Triangle side lengths should be a positive numbers." )
|
||||
norm([opp,adj]);
|
||||
|
||||
|
||||
// Function: opp_adj_to_hyp()
|
||||
// Synopsis: Returns the hypotenuse length from the lengths of the opposite and adjacent sides.
|
||||
// Topics: Geometry, Trigonometry, Triangles
|
||||
// See Also: adj_ang_to_hyp(), adj_ang_to_opp(), adj_opp_to_ang(), adj_opp_to_hyp(), hyp_adj_to_ang(), hyp_adj_to_opp(), hyp_ang_to_adj(), hyp_ang_to_opp(), hyp_opp_to_adj(), hyp_opp_to_ang(), opp_ang_to_adj(), opp_ang_to_hyp(), ang_adj_to_hyp(), ang_adj_to_opp(), opp_adj_to_ang(), opp_adj_to_hyp(), adj_hyp_to_ang(), adj_hyp_to_opp(), ang_hyp_to_adj(), ang_hyp_to_opp(), opp_hyp_to_adj(), opp_hyp_to_ang(), ang_opp_to_adj(), ang_opp_to_hyp()
|
||||
// Usage:
|
||||
// hyp = opp_adj_to_hyp(opp,adj);
|
||||
// Description:
|
||||
// Given the length of the opposite and adjacent sides of a right triangle, returns the length of the hypotenuse.
|
||||
// Arguments:
|
||||
// opp = The length of the side of the right triangle that is opposite from the primary angle.
|
||||
// adj = The length of the side of the right triangle that is adjacent to the primary angle.
|
||||
// Example:
|
||||
// hyp = opp_adj_to_hyp(4,3); // Returns: 5
|
||||
function opp_adj_to_hyp(opp,adj) = adj_opp_to_hyp(adj,opp);
|
||||
|
||||
|
||||
// Function: adj_ang_to_hyp()
|
||||
// Alias: ang_adj_to_hyp()
|
||||
// Synopsis: Returns the hypotenuse length from the length of the adjacent and the angle.
|
||||
// Synopsis: Returns the hypotenuse length from the length of the adjacent side and the primary angle.
|
||||
// Topics: Geometry, Trigonometry, Triangles
|
||||
// See Also: adj_ang_to_hyp(), adj_ang_to_opp(), adj_opp_to_ang(), adj_opp_to_hyp(), hyp_adj_to_ang(), hyp_adj_to_opp(), hyp_ang_to_adj(), hyp_ang_to_opp(), hyp_opp_to_adj(), hyp_opp_to_ang(), opp_ang_to_adj(), opp_ang_to_hyp()
|
||||
// See Also: adj_ang_to_hyp(), adj_ang_to_opp(), adj_opp_to_ang(), adj_opp_to_hyp(), hyp_adj_to_ang(), hyp_adj_to_opp(), hyp_ang_to_adj(), hyp_ang_to_opp(), hyp_opp_to_adj(), hyp_opp_to_ang(), opp_ang_to_adj(), opp_ang_to_hyp(), ang_adj_to_hyp(), ang_adj_to_opp(), opp_adj_to_ang(), opp_adj_to_hyp(), adj_hyp_to_ang(), adj_hyp_to_opp(), ang_hyp_to_adj(), ang_hyp_to_opp(), opp_hyp_to_adj(), opp_hyp_to_ang(), ang_opp_to_adj(), ang_opp_to_hyp()
|
||||
// Usage:
|
||||
// hyp = adj_ang_to_hyp(adj,ang);
|
||||
// hyp = ang_adj_to_hyp(ang,adj);
|
||||
// Description:
|
||||
// For a right triangle, given the length of the adjacent side, and the corner angle, returns the length of the hypotenuse.
|
||||
// Arguments:
|
||||
|
|
@ -303,19 +388,31 @@ function adj_ang_to_hyp(adj,ang) =
|
|||
assert(is_finite(ang) && ang>-90 && ang<90, "The angle should be an acute angle." )
|
||||
adj/cos(ang);
|
||||
|
||||
|
||||
// Function: ang_adj_to_hyp()
|
||||
// Synopsis: Returns the hypotenuse length from the primary angle and length of the adjacent side.
|
||||
// Topics: Geometry, Trigonometry, Triangles
|
||||
// See Also: adj_ang_to_hyp(), adj_ang_to_opp(), adj_opp_to_ang(), adj_opp_to_hyp(), hyp_adj_to_ang(), hyp_adj_to_opp(), hyp_ang_to_adj(), hyp_ang_to_opp(), hyp_opp_to_adj(), hyp_opp_to_ang(), opp_ang_to_adj(), opp_ang_to_hyp(), ang_adj_to_hyp(), ang_adj_to_opp(), opp_adj_to_ang(), opp_adj_to_hyp(), adj_hyp_to_ang(), adj_hyp_to_opp(), ang_hyp_to_adj(), ang_hyp_to_opp(), opp_hyp_to_adj(), opp_hyp_to_ang(), ang_opp_to_adj(), ang_opp_to_hyp()
|
||||
// Usage:
|
||||
// hyp = ang_adj_to_hyp(ang,adj);
|
||||
// Description:
|
||||
// For a right triangle, given the primary angle and length of the adjacent side, returns the length of the hypotenuse.
|
||||
// Arguments:
|
||||
// ang = The angle in degrees of the primary corner of the right triangle.
|
||||
// adj = The length of the side of the right triangle that is adjacent to the primary angle.
|
||||
// Example:
|
||||
// hyp = ang_adj_to_hyp(60,4); // Returns: 8
|
||||
function ang_adj_to_hyp(ang,adj) = adj_ang_to_hyp(adj,ang);
|
||||
|
||||
|
||||
// Function: opp_ang_to_hyp()
|
||||
// Alias: ang_opp_to_hyp()
|
||||
// Synopsis: Returns the hypotenuse length from the length of the opposite side and the angle.
|
||||
// Synopsis: Returns the hypotenuse length from the length of the opposite side and the primary angle.
|
||||
// Topics: Geometry, Trigonometry, Triangles
|
||||
// See Also: adj_ang_to_hyp(), adj_ang_to_opp(), adj_opp_to_ang(), adj_opp_to_hyp(), hyp_adj_to_ang(), hyp_adj_to_opp(), hyp_ang_to_adj(), hyp_ang_to_opp(), hyp_opp_to_adj(), hyp_opp_to_ang(), opp_ang_to_adj(), opp_ang_to_hyp()
|
||||
// See Also: adj_ang_to_hyp(), adj_ang_to_opp(), adj_opp_to_ang(), adj_opp_to_hyp(), hyp_adj_to_ang(), hyp_adj_to_opp(), hyp_ang_to_adj(), hyp_ang_to_opp(), hyp_opp_to_adj(), hyp_opp_to_ang(), opp_ang_to_adj(), opp_ang_to_hyp(), ang_adj_to_hyp(), ang_adj_to_opp(), opp_adj_to_ang(), opp_adj_to_hyp(), adj_hyp_to_ang(), adj_hyp_to_opp(), ang_hyp_to_adj(), ang_hyp_to_opp(), opp_hyp_to_adj(), opp_hyp_to_ang(), ang_opp_to_adj(), ang_opp_to_hyp()
|
||||
// Usage:
|
||||
// hyp = opp_ang_to_hyp(opp,ang);
|
||||
// hyp = ang_opp_to_hyp(ang,opp);
|
||||
// Description:
|
||||
// For a right triangle, given the length of the opposite side, and the corner angle, returns the length of the hypotenuse.
|
||||
// For a right triangle, given the length of the opposite side, and the primary corner angle, returns the length of the hypotenuse.
|
||||
// Arguments:
|
||||
// opp = The length of the side of the right triangle that is opposite from the primary angle.
|
||||
// ang = The angle in degrees of the primary corner of the right triangle.
|
||||
|
|
@ -326,19 +423,31 @@ function opp_ang_to_hyp(opp,ang) =
|
|||
assert(is_finite(ang) && ang>-90 && ang<90, "The angle should be an acute angle." )
|
||||
opp/sin(ang);
|
||||
|
||||
// Function: ang_opp_to_hyp()
|
||||
// Synopsis: Returns the hypotenuse length from the primary angle and the length of the opposite side.
|
||||
// Topics: Geometry, Trigonometry, Triangles
|
||||
// See Also: adj_ang_to_hyp(), adj_ang_to_opp(), adj_opp_to_ang(), adj_opp_to_hyp(), hyp_adj_to_ang(), hyp_adj_to_opp(), hyp_ang_to_adj(), hyp_ang_to_opp(), hyp_opp_to_adj(), hyp_opp_to_ang(), opp_ang_to_adj(), opp_ang_to_hyp(), ang_adj_to_hyp(), ang_adj_to_opp(), opp_adj_to_ang(), opp_adj_to_hyp(), adj_hyp_to_ang(), adj_hyp_to_opp(), ang_hyp_to_adj(), ang_hyp_to_opp(), opp_hyp_to_adj(), opp_hyp_to_ang(), ang_opp_to_adj(), ang_opp_to_hyp()
|
||||
// Usage:
|
||||
// hyp = ang_opp_to_hyp(ang,opp);
|
||||
// Description:
|
||||
// For a right triangle, given the primary corner angle and the length of the opposite side, returns the length of the hypotenuse.
|
||||
// Arguments:
|
||||
// ang = The angle in degrees of the primary corner of the right triangle.
|
||||
// opp = The length of the side of the right triangle that is opposite from the primary angle.
|
||||
// Example:
|
||||
// hyp = opp_ang_to_hyp(30,4); // Returns: 8
|
||||
function ang_opp_to_hyp(ang,opp) = opp_ang_to_hyp(opp,ang);
|
||||
|
||||
|
||||
|
||||
// Function: hyp_adj_to_ang()
|
||||
// Alias: adj_hyp_to_ang()
|
||||
// Synopsis: Returns the angle from the lengths of the hypotenuse and the adjacent side.
|
||||
// Topics: Geometry, Trigonometry, Triangles
|
||||
// See Also: adj_ang_to_hyp(), adj_ang_to_opp(), adj_opp_to_ang(), adj_opp_to_hyp(), hyp_adj_to_ang(), hyp_adj_to_opp(), hyp_ang_to_adj(), hyp_ang_to_opp(), hyp_opp_to_adj(), hyp_opp_to_ang(), opp_ang_to_adj(), opp_ang_to_hyp()
|
||||
// See Also: adj_ang_to_hyp(), adj_ang_to_opp(), adj_opp_to_ang(), adj_opp_to_hyp(), hyp_adj_to_ang(), hyp_adj_to_opp(), hyp_ang_to_adj(), hyp_ang_to_opp(), hyp_opp_to_adj(), hyp_opp_to_ang(), opp_ang_to_adj(), opp_ang_to_hyp(), ang_adj_to_hyp(), ang_adj_to_opp(), opp_adj_to_ang(), opp_adj_to_hyp(), adj_hyp_to_ang(), adj_hyp_to_opp(), ang_hyp_to_adj(), ang_hyp_to_opp(), opp_hyp_to_adj(), opp_hyp_to_ang(), ang_opp_to_adj(), ang_opp_to_hyp()
|
||||
// Usage:
|
||||
// ang = hyp_adj_to_ang(hyp,adj);
|
||||
// ang = adj_hyp_to_ang(adj,hyp);
|
||||
// Description:
|
||||
// For a right triangle, given the lengths of the hypotenuse and the adjacent sides, returns the angle of the corner.
|
||||
// For a right triangle, given the lengths of the hypotenuse and the adjacent side, returns the angle of the primary corner.
|
||||
// Arguments:
|
||||
// hyp = The length of the hypotenuse of the right triangle.
|
||||
// adj = The length of the side of the right triangle that is adjacent to the primary angle.
|
||||
|
|
@ -349,19 +458,31 @@ function hyp_adj_to_ang(hyp,adj) =
|
|||
"Triangle side lengths should be positive numbers." )
|
||||
acos(adj/hyp);
|
||||
|
||||
|
||||
// Function: adj_hyp_to_ang()
|
||||
// Synopsis: Returns the angle from the lengths of the adjacent side and the hypotenuse.
|
||||
// Topics: Geometry, Trigonometry, Triangles
|
||||
// See Also: adj_ang_to_hyp(), adj_ang_to_opp(), adj_opp_to_ang(), adj_opp_to_hyp(), hyp_adj_to_ang(), hyp_adj_to_opp(), hyp_ang_to_adj(), hyp_ang_to_opp(), hyp_opp_to_adj(), hyp_opp_to_ang(), opp_ang_to_adj(), opp_ang_to_hyp(), ang_adj_to_hyp(), ang_adj_to_opp(), opp_adj_to_ang(), opp_adj_to_hyp(), adj_hyp_to_ang(), adj_hyp_to_opp(), ang_hyp_to_adj(), ang_hyp_to_opp(), opp_hyp_to_adj(), opp_hyp_to_ang(), ang_opp_to_adj(), ang_opp_to_hyp()
|
||||
// Usage:
|
||||
// ang = adj_hyp_to_ang(adj,hyp);
|
||||
// Description:
|
||||
// For a right triangle, given the lengths of the adjacent side and the hypotenuse, returns the angle of the primary corner.
|
||||
// Arguments:
|
||||
// adj = The length of the side of the right triangle that is adjacent to the primary angle.
|
||||
// hyp = The length of the hypotenuse of the right triangle.
|
||||
// Example:
|
||||
// ang = adj_hyp_to_ang(4,8); // Returns: 60 degrees
|
||||
function adj_hyp_to_ang(adj,hyp) = hyp_adj_to_ang(hyp,adj);
|
||||
|
||||
|
||||
// Function: hyp_opp_to_ang()
|
||||
// Alias: opp_hyp_to_ang()
|
||||
// Synopsis: Returns the angle from the lengths of the hypotenuse and the opposite side.
|
||||
// Synopsis: Returns the primary angle from the lengths of the hypotenuse and the opposite side.
|
||||
// Topics: Geometry, Trigonometry, Triangles
|
||||
// See Also: adj_ang_to_hyp(), adj_ang_to_opp(), adj_opp_to_ang(), adj_opp_to_hyp(), hyp_adj_to_ang(), hyp_adj_to_opp(), hyp_ang_to_adj(), hyp_ang_to_opp(), hyp_opp_to_adj(), hyp_opp_to_ang(), opp_ang_to_adj(), opp_ang_to_hyp()
|
||||
// See Also: adj_ang_to_hyp(), adj_ang_to_opp(), adj_opp_to_ang(), adj_opp_to_hyp(), hyp_adj_to_ang(), hyp_adj_to_opp(), hyp_ang_to_adj(), hyp_ang_to_opp(), hyp_opp_to_adj(), hyp_opp_to_ang(), opp_ang_to_adj(), opp_ang_to_hyp(), ang_adj_to_hyp(), ang_adj_to_opp(), opp_adj_to_ang(), opp_adj_to_hyp(), adj_hyp_to_ang(), adj_hyp_to_opp(), ang_hyp_to_adj(), ang_hyp_to_opp(), opp_hyp_to_adj(), opp_hyp_to_ang(), ang_opp_to_adj(), ang_opp_to_hyp()
|
||||
// Usage:
|
||||
// ang = hyp_opp_to_ang(hyp,opp);
|
||||
// ang = opp_hyp_to_ang(opp,hyp);
|
||||
// Description:
|
||||
// For a right triangle, given the lengths of the hypotenuse and the opposite sides, returns the angle of the corner.
|
||||
// For a right triangle, given the lengths of the hypotenuse and the opposite sides, returns the angle of the primary corner.
|
||||
// Arguments:
|
||||
// hyp = The length of the hypotenuse of the right triangle.
|
||||
// opp = The length of the side of the right triangle that is opposite from the primary angle.
|
||||
|
|
@ -372,17 +493,28 @@ function hyp_opp_to_ang(hyp,opp) =
|
|||
"Triangle side lengths should be positive numbers." )
|
||||
asin(opp/hyp);
|
||||
|
||||
// Function: opp_hyp_to_ang()
|
||||
// Synopsis: Returns the primary angle from the lengths of the opposite side and the hypotenuse.
|
||||
// Topics: Geometry, Trigonometry, Triangles
|
||||
// See Also: adj_ang_to_hyp(), adj_ang_to_opp(), adj_opp_to_ang(), adj_opp_to_hyp(), hyp_adj_to_ang(), hyp_adj_to_opp(), hyp_ang_to_adj(), hyp_ang_to_opp(), hyp_opp_to_adj(), hyp_opp_to_ang(), opp_ang_to_adj(), opp_ang_to_hyp(), ang_adj_to_hyp(), ang_adj_to_opp(), opp_adj_to_ang(), opp_adj_to_hyp(), adj_hyp_to_ang(), adj_hyp_to_opp(), ang_hyp_to_adj(), ang_hyp_to_opp(), opp_hyp_to_adj(), opp_hyp_to_ang(), ang_opp_to_adj(), ang_opp_to_hyp()
|
||||
// Usage:
|
||||
// ang = opp_hyp_to_ang(opp,hyp);
|
||||
// Description:
|
||||
// For a right triangle, given the lengths of the opposite side and the hypotenuse, returns the angle of the primary corner.
|
||||
// Arguments:
|
||||
// opp = The length of the side of the right triangle that is opposite from the primary angle.
|
||||
// hyp = The length of the hypotenuse of the right triangle.
|
||||
// Example:
|
||||
// ang = opp_hyp_to_ang(4,8); // Returns: 30 degrees
|
||||
function opp_hyp_to_ang(opp,hyp) = hyp_opp_to_ang(hyp,opp);
|
||||
|
||||
|
||||
// Function: adj_opp_to_ang()
|
||||
// Alias: opp_adj_to_ang()
|
||||
// Synopsis: Returns the angle from the lengths of the adjacent and opposite sides.
|
||||
// Topics: Geometry, Trigonometry, Triangles
|
||||
// See Also: adj_ang_to_hyp(), adj_ang_to_opp(), adj_opp_to_ang(), adj_opp_to_hyp(), hyp_adj_to_ang(), hyp_adj_to_opp(), hyp_ang_to_adj(), hyp_ang_to_opp(), hyp_opp_to_adj(), hyp_opp_to_ang(), opp_ang_to_adj(), opp_ang_to_hyp()
|
||||
// See Also: adj_ang_to_hyp(), adj_ang_to_opp(), adj_opp_to_ang(), adj_opp_to_hyp(), hyp_adj_to_ang(), hyp_adj_to_opp(), hyp_ang_to_adj(), hyp_ang_to_opp(), hyp_opp_to_adj(), hyp_opp_to_ang(), opp_ang_to_adj(), opp_ang_to_hyp(), ang_adj_to_hyp(), ang_adj_to_opp(), opp_adj_to_ang(), opp_adj_to_hyp(), adj_hyp_to_ang(), adj_hyp_to_opp(), ang_hyp_to_adj(), ang_hyp_to_opp(), opp_hyp_to_adj(), opp_hyp_to_ang(), ang_opp_to_adj(), ang_opp_to_hyp()
|
||||
// Usage:
|
||||
// ang = adj_opp_to_ang(adj,opp);
|
||||
// ang = opp_adj_to_ang(opp,adj);
|
||||
// Description:
|
||||
// For a right triangle, given the lengths of the adjacent and opposite sides, returns the angle of the corner.
|
||||
// Arguments:
|
||||
|
|
@ -395,8 +527,26 @@ function adj_opp_to_ang(adj,opp) =
|
|||
"Triangle side lengths should be positive numbers." )
|
||||
atan2(opp,adj);
|
||||
|
||||
|
||||
// Function: opp_adj_to_ang()
|
||||
// Synopsis: Returns the primary angle from the lengths of the opposite and adjacent sides.
|
||||
// Topics: Geometry, Trigonometry, Triangles
|
||||
// See Also: adj_ang_to_hyp(), adj_ang_to_opp(), adj_opp_to_ang(), adj_opp_to_hyp(), hyp_adj_to_ang(), hyp_adj_to_opp(), hyp_ang_to_adj(), hyp_ang_to_opp(), hyp_opp_to_adj(), hyp_opp_to_ang(), opp_ang_to_adj(), opp_ang_to_hyp(), ang_adj_to_hyp(), ang_adj_to_opp(), opp_adj_to_ang(), opp_adj_to_hyp(), adj_hyp_to_ang(), adj_hyp_to_opp(), ang_hyp_to_adj(), ang_hyp_to_opp(), opp_hyp_to_adj(), opp_hyp_to_ang(), ang_opp_to_adj(), ang_opp_to_hyp()
|
||||
// Usage:
|
||||
// ang = opp_adj_to_ang(opp,adj);
|
||||
// Description:
|
||||
// For a right triangle, given the lengths of the opposite and adjacent sides, returns the angle of the primary corner.
|
||||
// Arguments:
|
||||
// opp = The length of the side of the right triangle that is opposite from the primary angle.
|
||||
// adj = The length of the side of the right triangle that is adjacent to the primary angle.
|
||||
// Example:
|
||||
// ang = opp_adj_to_ang(0.5,sqrt(3)/2); // Returns: 30 degrees
|
||||
function opp_adj_to_ang(opp,adj) = adj_opp_to_ang(adj,opp);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// vim: expandtab tabstop=4 shiftwidth=4 softtabstop=4 nowrap
|
||||
|
|
|
|||
Loading…
Reference in a new issue