1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: point3d.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _B2D_POINT3D_HXX
32 #define _B2D_POINT3D_HXX
35 #include <tools/stream.hxx>
39 #include <tools/gen.hxx>
43 #include <tools/vector2d.hxx>
46 /*************************************************************************
48 |* homogener 3D-Punkt (x,y,w)
50 \************************************************************************/
56 // 3 Dimensinen, X,Y und W
60 Point3D(double fX
= 0.0, double fY
= 0.0, double fW
= 1.0)
61 { V
[0] = fX
; V
[1] = fY
; V
[2] = fW
; }
63 const double& X() const { return V
[0]; }
64 const double& Y() const { return V
[1]; }
65 const double& W() const { return V
[2]; }
67 double& X() { return V
[0]; }
68 double& Y() { return V
[1]; }
69 double& W() { return V
[2]; }
71 const double& operator[] (int nPos
) const { return V
[nPos
]; }
72 double& operator[] (int nPos
) { return V
[nPos
]; }
74 // Rechnen untereinander
75 Point3D
& operator+= (const Point3D
&);
76 Point3D
& operator-= (const Point3D
&);
77 Point3D
operator+ (const Point3D
&) const;
78 Point3D
operator- (const Point3D
&) const;
79 Point3D
operator- (void) const;
80 Point3D
& operator*= (const Point3D
&);
81 Point3D
& operator/= (const Point3D
&);
82 Point3D
operator* (const Point3D
&) const;
83 Point3D
operator/ (const Point3D
&) const;
85 // Verschiebung um einen Vektor
86 Point3D
& operator+= (const Vector2D
&);
87 Point3D
& operator-= (const Vector2D
&);
88 Point3D
operator+ (const Vector2D
&) const;
89 Point3D
operator- (const Vector2D
&) const;
91 // Multiplikation, Division um einen Faktor
92 Point3D
& operator*= (double);
93 Point3D
operator* (double) const;
94 Point3D
& operator/= (double);
95 Point3D
operator/ (double) const;
97 BOOL
operator== (const Point3D
&) const;
98 BOOL
operator!= (const Point3D
&) const;
100 friend SvStream
& operator>>(SvStream
& rIStream
, Point3D
&);
101 friend SvStream
& operator<<(SvStream
& rOStream
, const Point3D
&);
103 }//end of namespace binfilter
106 #endif // _B2D_POINT3D_HXX