downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

acosh> <abs
[edit] Last updated: Fri, 18 Sep 2009

view this page in

acos

(PHP 4, PHP 5)

acosАркускосинус

Описание

float acos ( float $arg )

Връща аркускосинус от arg в радиани. acos() е обратната функция на cos(), което означава, че a==cos(acos(a)) за всяка стойност на а, която е в допустимите стойности на acos() функцията.

Параметри

arg

Аргументът за обработване

Връщани стойности

Аркускосинусът на arg в радиани.

Вж. също

  • cos() - Косинус
  • acosh() - Обратен хиперболичен косинус
  • asin() - Аркуссинус
  • atan() - Аркустангенс



add a note add a note User Contributed Notes acos
anthony at interiorgoodsdirect dot com 04-Dec-2007 10:28
To calculate an angle from a triangle's sides.

Use the 'law of cosines' :

<?php
//        a²+b²-c²           
// cosC = --------
//           2ab

function calculateAngle($c,$a,$b)
{
   
$angleInRadians=acos((pow($a,2) + pow($b,2) - pow($c,2)) / (2 * $a * $b));
    return
rad2deg($angleInRadians);
}
?>

$a, $b, $c are the triangle sides.

The function returns the angle opposite side c, in degrees.
zoltan dot szentesi at nokia dot com 05-Aug-2006 09:29
Wondering what is the use of 'acos' function?

It is essential in games, animations and drawings to determine the location of two objects relating to each other.

To the point: the angle of two vectors is calculated by

           v1X*v2X + v1Y*v2Y
  acos(--------------------------)=angle between two vectors.
               |v1| * |v2|

 |v1| and |v2| are the length of the vectors and calculated using Pithagoras-formula: |v1|=sqrt(v1X*v1X + v1Y*v1Y)

This helped me to calculate and share given space for 'n' amount of objects so that they don't overlap.

Enjoy! :-)

 
show source | credits | stats | sitemap | contact | advertising | mirror sites