summaryrefslogtreecommitdiffstats
path: root/src/VBox/GuestHost/OpenGL/util/warp.c
blob: 0e008db9d3da210063b898a34c81a26c1b5b03f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/* Copyright (c) 2001, Stanford University
 * All rights reserved
 *
 * See the file LICENSE.txt for information on redistributing this software.
 */

#include "cr_error.h"
#include "cr_warp.h"

void
crWarpPoint(const float *align, const float *point, float *result)
{
	float w, x, y;

	x = align[0] * point[0] + align[1] * point[1] + align[2];
	y = align[3] * point[0] + align[4] * point[1] + align[5];
	w = align[6] * point[0] + align[7] * point[1] + align[8];

	if (w == 0)
		crError("Crud in alignment matrix --> w == 0. bleh!");

	result[0] = x / w;
	result[1] = y / w;
}