/******************************************************************** * Description: * Author: George-Catalin Serbanut * * Copyright (c) 2005 George-Catalin Serbanut All rights reserved. * ********************************************************************/ /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include "include/line.hh" #include "include/angles.hh" #include "include/math.hh" using namespace std; Line::Line() { } Line::~Line() { } Line::Line(Point P1, Point P2) { Line::number_points = 2; Line::points.push_back(P1); Line::points.push_back(P2); Line::SetColiniarity(); } Line::Line(vector vp) { switch (vp.size()) { case 0: cout<<"Warning: Not enogh number of points!"< vp) { switch (vp.size()) { case 0: cout<<"Warning: Not enogh number of points!"< Line::GetPoints() { return Line::points; } vector Line::GetLine() { return Line::coliniar_points; } bool Line::CheckColiniarity() { bool coliniarity = true; Angles angles; Line::Precision(); if(Line::number_points>2) { for(int i=0; iGetPoint())); delete point; }; for(int i=0; i(points.size()); chi = 0.0; psi = 0.0; omega = 0.0; for(int i=0; i(vangles.size()); psi += vangles[i].GetPsi()/static_cast(vangles.size()); omega += vangles[i].GetOmega()/static_cast(vangles.size()); }; Line::coliniar_points.push_back(Point(central_point.GetX()-100.0*tan(psi), central_point.GetY()-100.0*tan(psi)*tan(omega), central_point.GetZ()-100.0)); Line::coliniar_points.push_back(Point(central_point.GetX()+100.0*tan(psi), central_point.GetY()+100.0*tan(psi)*tan(omega), central_point.GetZ()+100.0)); }; return; } void Line::Precision() { Math math; Line::precision = math.precision; }