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: b2dquadraticbezier.cxx,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 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_basegfx.hxx"
33 #include <basegfx/curve/b2dquadraticbezier.hxx>
34 #include <basegfx/numeric/ftools.hxx>
36 //////////////////////////////////////////////////////////////////////////////
40 B2DQuadraticBezier::B2DQuadraticBezier(const B2DQuadraticBezier
& rBezier
)
41 : maStartPoint(rBezier
.maStartPoint
),
42 maEndPoint(rBezier
.maEndPoint
),
43 maControlPoint(rBezier
.maControlPoint
)
47 B2DQuadraticBezier::B2DQuadraticBezier()
51 B2DQuadraticBezier::B2DQuadraticBezier(const ::basegfx::B2DPoint
& rStart
, const ::basegfx::B2DPoint
& rEnd
)
52 : maStartPoint(rStart
),
57 B2DQuadraticBezier::B2DQuadraticBezier(const ::basegfx::B2DPoint
& rStart
, const ::basegfx::B2DPoint
& rControl
, const ::basegfx::B2DPoint
& rEnd
)
58 : maStartPoint(rStart
),
60 maControlPoint(rControl
)
64 B2DQuadraticBezier::~B2DQuadraticBezier()
68 // assignment operator
69 B2DQuadraticBezier
& B2DQuadraticBezier::operator=(const B2DQuadraticBezier
& rBezier
)
71 maStartPoint
= rBezier
.maStartPoint
;
72 maEndPoint
= rBezier
.maEndPoint
;
73 maControlPoint
= rBezier
.maControlPoint
;
79 bool B2DQuadraticBezier::operator==(const B2DQuadraticBezier
& rBezier
) const
82 maStartPoint
== rBezier
.maStartPoint
83 && maEndPoint
== rBezier
.maEndPoint
84 && maControlPoint
== rBezier
.maControlPoint
88 bool B2DQuadraticBezier::operator!=(const B2DQuadraticBezier
& rBezier
) const
91 maStartPoint
!= rBezier
.maStartPoint
92 || maEndPoint
!= rBezier
.maEndPoint
93 || maControlPoint
!= rBezier
.maControlPoint
97 // test if control vector is used
98 bool B2DQuadraticBezier::isBezier() const
100 // if control vector is empty, bezier is not used
101 if(maControlPoint
== maStartPoint
|| maControlPoint
== maEndPoint
)
106 } // end of namespace basegfx