Back to index

texmacs  1.0.7.15
point.hpp
Go to the documentation of this file.
00001 
00002 /******************************************************************************
00003 * MODULE     : point.hpp
00004 * DESCRIPTION: points
00005 * COPYRIGHT  : (C) 2003  Joris van der Hoeven
00006 *******************************************************************************
00007 * This software falls under the GNU general public license version 3 or later.
00008 * It comes WITHOUT ANY WARRANTY WHATSOEVER. For details, see the file LICENSE
00009 * in the root directory or <http://www.gnu.org/licenses/gpl-3.0.html>.
00010 ******************************************************************************/
00011 
00012 #ifndef POINT_H
00013 #define POINT_H
00014 #include "tree.hpp"
00015 
00016 typedef array<double> point;
00017 
00018 point operator -  (point p);
00019 point operator +  (point p1, point p2);
00020 point operator -  (point p1, point p2);
00021 point operator *  (double x, point p );
00022 point operator /  (point  p, double x);
00023 bool  operator == (point p1, point p2);
00024 
00025 bool is_point (tree t);
00026 inline point as_point(double x) {
00027   point p(1); p[0]=x; return p; }
00028 point as_point (tree t);
00029 tree  as_tree (point p);
00030 
00031 double operator * (point p1, point p2);
00032 point  rotate_2D (point p, point o, double angle);
00033 
00034 double norm (point p);
00035 double arg (point p);
00036 bool   collinear (point p1, point p2);
00037 bool   linearly_dependent (point p1, point p2, point p3);
00038 bool   orthogonalize (point &i, point &j, point p1, point p2, point p3);
00039 
00040 typedef struct { point p0, p1; } axis;
00041 
00042 point  proj         (axis a, point p);
00043 double dist         (axis a, point p);
00044 double seg_dist     (axis a, point p);
00045 axis   midperp      (point p1, point p2, point p3);
00046 point  intersection (axis A, axis B);
00047 
00048 bool inside_rectangle (point p, point p1, point p2);
00049 
00050 #endif // defined POINT_H