Home

Download

Features

Screenshots

Handbook

Browse Source

Authors

SourceForge.net Logo
Hosted by SourceForge.net

OSI Certified


Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   Related Pages   Search  

intersectionfunction.cpp

00001 /***************************************************************************
00002                           intersectionfunction.cpp  -  description
00003                              -------------------
00004     begin                : Tue Nov 12 2002
00005     copyright            : (C) 2002 by Fungmeista
00006     email                : mizunoami44@sourceforge.net
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #include <cmath> 
00019  
00020 #include "intersectionfunction.h"
00021 
00022 IntersectionFunction::IntersectionFunction(BasicGraph *graph, int expressions) : MathFunction(graph,expressions)
00023 {
00024 }
00025 IntersectionFunction::~IntersectionFunction()
00026 {
00027 }
00028 
00029 void IntersectionFunction::calculate_and_draw(QPainter *)
00030 {
00031     
00032 }
00033 /*
00034 void Intersect_Lines(float x0,float y0,float x1,float y1,
00035                      float x2,float y2,float x3,float y3,
00036                      float *xi,float *yi)
00037 {
00038 
00039 float a1,b1,c1, // constants of linear equations
00040       a2,b2,c2,
00041       det_inv,  // the inverse of the determinant of the coefficient
00042                 //matrix
00043       m1,m2;    // the slopes of each line
00044 
00045 // compute slopes, note the cludge for infinity, however, this will
00046 // be close enough
00047 
00048 if ((x1-x0)!=0)
00049    m1 = (y1-y0)/(x1-x0);
00050 else
00051    m1 = (float)1e+10;   // close enough to infinity
00052 
00053 if ((x3-x2)!=0)
00054    m2 = (y3-y2)/(x3-x2);
00055 else
00056    m2 = (float)1e+10;   // close enough to infinity
00057 
00058 // compute constants
00059 
00060 a1 = m1;
00061 a2 = m2;
00062 
00063 b1 = -1;
00064 b2 = -1;
00065 
00066 c1 = (y0-m1*x0);
00067 c2 = (y2-m2*x2);
00068 
00069 // compute the inverse of the determinate
00070 
00071 det_inv = 1/(a1*b2 - a2*b1);
00072 
00073 // use Kramers rule to compute xi and yi
00074 
00075 *xi=((b1*c2 - b2*c1)*det_inv);
00076 *yi=((a2*c1 - a1*c2)*det_inv);
00077 
00078 } // end Intersect_Lines
00079 
00080 */