BWAPI
|
00001 // Copyright (c) 1997 INRIA Sophia-Antipolis (France). 00002 // All rights reserved. 00003 // 00004 // This file is part of CGAL (www.cgal.org); you may redistribute it under 00005 // the terms of the Q Public License version 1.0. 00006 // See the file LICENSE.QPL distributed with CGAL. 00007 // 00008 // Licensees holding a valid commercial license may use this file in 00009 // accordance with the commercial license agreement provided with the software. 00010 // 00011 // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 00012 // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 00013 // 00014 // $URL: svn+ssh://scm.gforge.inria.fr/svn/cgal/branches/CGAL-3.5-branch/Triangulation_2/include/CGAL/constructions_on_weighted_points_homogeneous_2.h $ 00015 // $Id: constructions_on_weighted_points_homogeneous_2.h 28567 2006-02-16 14:30:13Z lsaboret $ 00016 // 00017 // 00018 // Author(s) : Julia Flototto, Mariette Yvinec 00019 00020 00021 #ifndef CGAL_CONSTRUCTIONS_ON_WEIGHTED_POINTS_HOMOGENEOUS_2_H 00022 #define CGAL_CONSTRUCTIONS_ON_WEIGHTED_POINTS_HOMOGENEOUS_2_H 00023 00024 CGAL_BEGIN_NAMESPACE 00025 00026 template < class RT, class We> 00027 void 00028 weighted_circumcenterH2( const RT &phx, const RT &phy, const RT &phw, 00029 const We &pwt, 00030 const RT &qhx, const RT &qhy, const RT &qhw, 00031 const We &qwt, 00032 const RT &rhx, const RT &rhy, const RT &rhw, 00033 const We &rwt, 00034 RT &vvx, RT &vvy, RT &vvw ) 00035 { 00036 00037 // RT qx_px = ( qhx*qhw*phw*phw - phx*phw*qhw*qhw ); 00038 // RT qy_py = ( qhy*qhw*phw*phw - phy*phw*qhw*qhw ); 00039 // RT rx_px = ( rhx*rhw*phw*phw - phx*phw*rhw*rhw ); 00040 // RT ry_py = ( rhy*rhw*phw*phw - phy*phw*rhw*rhw ); 00041 00042 // //intersection of the two radical axis of (qp) and (rp) 00043 // RT px2_py2_rx2_ry_2 = 00044 // phx*phx*rhw*rhw + phy*phy*rhw*rhw - rhx*rhx*phw*phw - 00045 // rhy*rhy*phw*phw - RT(pwt*pwt) + RT(rwt*rwt); 00046 // RT px2_py2_qx2_qy_2 = 00047 // phx*phx*qhw*qhw + phy*phy*qhw*qhw - qhx*qhx*phw*phw - 00048 // qhy*qhy*phw*phw - RT(pwt*pwt) + RT(qwt*qwt); 00049 00050 // vvx = qy_py * px2_py2_rx2_ry_2 - ry_py * px2_py2_qx2_qy_2; 00051 // vvy = rx_px * px2_py2_qx2_qy_2 - qx_px * px2_py2_rx2_ry_2; 00052 // vvw = RT(2) * ( qx_px * ry_py - rx_px * qy_py ); 00053 00054 RT a1, b1, c1; 00055 RT a2, b2, c2; 00056 radical_axisH2(phx,phy,phw,pwt,qhx,qhy,qhw,qwt,a1,b1,c1); 00057 radical_axisH2(phx,phy,phw,pwt,rhx,rhy,rhw,rwt,a2,b2,c2); 00058 vvx = b1*c2 - c1*b2; 00059 vvy = c1*a2 - c2*a1; 00060 vvw = a1*b2 - a2*b1; 00061 } 00062 00063 00064 template < class RT , class We> 00065 void 00066 radical_axisH2(const RT &phx, const RT &phy, const RT &phw, const We &pwt, 00067 const RT &qhx, const RT &qhy, const RT &qhw, const We &qwt, 00068 RT &a, RT &b, RT &c ) 00069 { 00070 // a = RT(2) * ( qhx*qhw*phw*phw - phx*phw*qhw*qhw ); 00071 // b = RT(2) * ( qhy*qhw*phw*phw - phy*phw*qhw*qhw ); 00072 // c = phx*phx*qhw*qhw + phy*phy*qhw*qhw - qhx*qhx*phw*phw 00073 // - qhy*qhy*phw*phw- RT(pwt*pwt) + RT(qwt*qwt); 00074 00075 a = RT(2) * ( phx*phw*qhw*qhw - qhx*qhw*phw*phw ); 00076 b = RT(2) * ( phy*phw*qhw*qhw - qhy*qhw*phw*phw ); 00077 c = - phx*phx*qhw*qhw - phy*phy*qhw*qhw 00078 + qhx*qhx*phw*phw + qhy*qhy*phw*phw 00079 + RT(pwt)*phw*phw*qhw*qhw - RT(qwt)*phw*phw*qhw*qhw; 00080 00081 } 00082 00083 00084 00085 00086 CGAL_END_NAMESPACE 00087 #endif //CGAL_CONSTRUCTIONS_ON_WEIGHTED_POINTS_HOMOGENEOUS_2_H