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: point4d.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 _B3D_POINT4D_HXX
32 #define _B3D_POINT4D_HXX
34 #ifndef _SVX_VECTOR3D_HXX //autogen
35 #include "vector3d.hxx"
38 #ifndef _SVX_POINT3D_HXX
39 #include "point3d.hxx"
43 #include <tools/stream.hxx>
47 /*************************************************************************
49 |* homogener 4D-Punkt (x,y,z,w)
51 \************************************************************************/
57 // 4 Dimensinen, X,Y,Z und W
60 void ImplHomogenize();
63 Point4D(double fX
= 0.0, double fY
= 0.0, double fZ
= 0.0, double fW
= 1.0)
64 { V
[0] = fX
; V
[1] = fY
; V
[2] = fZ
; V
[3] = fW
; }
65 Point4D(const Vector3D
& rVec
, double fW
= 1.0);
67 const double& X() const { return V
[0]; }
68 const double& Y() const { return V
[1]; }
69 const double& Z() const { return V
[2]; }
70 const double& W() const { return V
[3]; }
72 double& X() { return V
[0]; }
73 double& Y() { return V
[1]; }
74 double& Z() { return V
[2]; }
75 double& W() { return V
[3]; }
77 const double& operator[] (int nPos
) const { return V
[nPos
]; }
78 double& operator[] (int nPos
) { return V
[nPos
]; }
80 void Homogenize() { if(V
[3] != 1.0) ImplHomogenize(); }
81 const Vector3D
& GetVector3D() const;
83 void CalcInBetween(Point4D
& rOld1
, Point4D
& rOld2
, double t
);
84 void CalcMiddle(Point4D
& rOld1
, Point4D
& rOld2
);
86 // Rechnen untereinander
87 Point4D
& operator+= (const Point4D
&);
88 Point4D
& operator-= (const Point4D
&);
89 Point4D
operator+ (const Point4D
&) const;
90 Point4D
operator- (const Point4D
&) const;
91 Point4D
operator- (void) const;
92 Point4D
& operator*= (const Point4D
&);
93 Point4D
& operator/= (const Point4D
&);
94 Point4D
operator* (const Point4D
&) const;
95 Point4D
operator/ (const Point4D
&) const;
97 // Verschiebung um einen Vektor
98 Point4D
& operator+= (const Vector3D
&);
99 Point4D
& operator-= (const Vector3D
&);
100 Point4D
operator+ (const Vector3D
&) const;
101 Point4D
operator- (const Vector3D
&) const;
103 // Multiplikation, Division um einen Faktor
104 Point4D
& operator*= (double);
105 Point4D
operator* (double) const;
106 Point4D
& operator/= (double);
107 Point4D
operator/ (double) const;
109 BOOL
operator== (const Point4D
&) const;
110 BOOL
operator!= (const Point4D
&) const;
112 friend SvStream
& operator>>(SvStream
& rIStream
, Point4D
&);
113 friend SvStream
& operator<<(SvStream
& rOStream
, const Point4D
&);
115 }//end of namespace binfilter
118 #endif // _B3D_POINT4D_HXX