1 | /* Copyright (c) 2001, Stanford University
|
---|
2 | * All rights reserved
|
---|
3 | *
|
---|
4 | * See the file LICENSE.txt for information on redistributing this software.
|
---|
5 | */
|
---|
6 |
|
---|
7 | #include "cr_error.h"
|
---|
8 | #include "cr_warp.h"
|
---|
9 |
|
---|
10 | void
|
---|
11 | crWarpPoint(const float *align, const float *point, float *result)
|
---|
12 | {
|
---|
13 | float w, x, y;
|
---|
14 |
|
---|
15 | x = align[0] * point[0] + align[1] * point[1] + align[2];
|
---|
16 | y = align[3] * point[0] + align[4] * point[1] + align[5];
|
---|
17 | w = align[6] * point[0] + align[7] * point[1] + align[8];
|
---|
18 |
|
---|
19 | if (w == 0)
|
---|
20 | crError("Crud in alignment matrix --> w == 0. bleh!");
|
---|
21 |
|
---|
22 | result[0] = x / w;
|
---|
23 | result[1] = y / w;
|
---|
24 | }
|
---|