O'Reilly logo

OpenCL Parallel Programming Development Cookbook by Raymond Tay

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using geometric functions

The geometric functions are used by the programmers to perform common computation on vectors, for example, cross or dot products, normalizing a vector, and length of a vector. To recap a little about vector cross and dot products, remember that a vector in the mathematical sense represents a quantity that has both direction and magnitude, and these vectors are used extensively in computer graphics.

Quite often, we need to compute the distance (in degrees or radians) between two vectors and to do this, we need to compute the dot product, which is defined as:

Using geometric functions

It follows that if a is perpendicular to b then it must be that ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required