~lib2geom-hackers/lib2geom/trunk

« back to all changes in this revision

Viewing changes to rotate-ops.h

  • Committer: njh
  • Date: 2006-05-22 11:50:24 UTC
  • Revision ID: svn-v4:4601daaa-0314-0410-9a8b-c964a3c23b6b:trunk/lib2geom:1
initial commit

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef SEEN_Geom_ROTATE_OPS_H
 
2
#define SEEN_Geom_ROTATE_OPS_H
 
3
#include "rotate.h"
 
4
 
 
5
namespace Geom {
 
6
 
 
7
inline Point operator*(Point const &v, rotate const &r)
 
8
{
 
9
    return Point(r.vec[X] * v[X] - r.vec[Y] * v[Y],
 
10
                 r.vec[Y] * v[X] + r.vec[X] * v[Y]);
 
11
}
 
12
 
 
13
inline rotate operator*(rotate const &a, rotate const &b)
 
14
{
 
15
    return rotate( a.vec * b );
 
16
}
 
17
 
 
18
inline rotate &rotate::operator*=(rotate const &b)
 
19
{
 
20
    *this = *this * b;
 
21
    return *this;
 
22
}
 
23
 
 
24
inline rotate operator/(rotate const &numer, rotate const &denom)
 
25
{
 
26
    return numer * denom.inverse();
 
27
}
 
28
 
 
29
}  /* namespace Geom */
 
30
 
 
31
 
 
32
#endif /* !SEEN_Geom_ROTATE_OPS_H */
 
33
 
 
34
/*
 
35
  Local Variables:
 
36
  mode:c++
 
37
  c-file-style:"stroustrup"
 
38
  c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
 
39
  indent-tabs-mode:nil
 
40
  fill-column:99
 
41
  End:
 
42
*/
 
43
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :