line_to_epoint.h
来自「CGAL is a collaborative effort of severa」· C头文件 代码 · 共 72 行
H
72 行
// Copyright (c) 1997-2000 Max-Planck-Institute Saarbruecken (Germany).// All rights reserved.//// This file is part of CGAL (www.cgal.org); you may redistribute it under// the terms of the Q Public License version 1.0.// See the file LICENSE.QPL distributed with CGAL.//// Licensees holding a valid commercial license may use this file in// accordance with the commercial license agreement provided with the software.//// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.//// $Source: /CVSROOT/CGAL/Packages/Nef_2/include/CGAL/Nef_2/Line_to_epoint.h,v $// $Revision: 1.5 $ $Date: 2003/10/21 12:21:00 $// $Name: $//// Author(s) : Michael Seel <seel@mpi-sb.mpg.de>#ifndef CGAL_LINE_TO_EPOINT_H#define CGAL_LINE_TO_EPOINT_HCGAL_BEGIN_NAMESPACEtemplate <class Kernel_>struct Line_to_epoint { typedef Kernel_ Kernel; typedef typename Kernel::RT RT; typedef typename Kernel::FT FT; typedef typename Kernel::Line_2 Line_2; enum Point_type { SWCORNER=1, LEFTFRAME, NWCORNER, BOTTOMFRAME, STANDARD, TOPFRAME, SECORNER, RIGHTFRAME, NECORNER }; static RT dx(const Line_2& l) { return l.b(); } static RT dy(const Line_2& l) { return -l.a(); } static FT ordinate_distance(const Line_2& l) { return Kernel::make_FT(-l.c(),l.b()); } static Point_type determine_type(const Line_2& l) { RT adx = CGAL_NTS abs(dx(l)), ady = CGAL_NTS abs(dy(l)); int sdx = CGAL_NTS sign(dx(l)), sdy = CGAL_NTS sign(dy(l)); int cmp_dx_dy = CGAL_NTS compare(adx,ady), s(1); if (sdx < 0 && ( cmp_dx_dy > 0 || cmp_dx_dy == 0 && sdy != (s = CGAL_NTS sign(ordinate_distance(l))))) { if (0 == s) return ( sdy < 0 ? SWCORNER : NWCORNER ); else return LEFTFRAME; } else if (sdx > 0 && ( cmp_dx_dy > 0 || cmp_dx_dy == 0 && sdy != (s = CGAL_NTS sign(ordinate_distance(l))))) { if (0 == s) return ( sdy < 0 ? SECORNER : NECORNER ); else return RIGHTFRAME; } else if (sdy < 0 && ( cmp_dx_dy < 0 || cmp_dx_dy == 0 && ordinate_distance(l) < FT(0))) { return BOTTOMFRAME; } else if (sdy > 0 && ( cmp_dx_dy < 0 || cmp_dx_dy == 0 && ordinate_distance(l) > FT(0))) { return TOPFRAME; } CGAL_assertion_msg(false," determine_type: degenerate line."); return (Point_type)-1; // never come here }};CGAL_END_NAMESPACE#endif //CGAL_LINE_TO_EPOINT_H
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?