/******************************************************************** * 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/plan.hh" #include "include/point.hh" #include "include/line.hh" #include "include/algebra.hh" #include "include/math.hh" using namespace std; Plan::Plan() { } Plan::~Plan() { } Plan::Plan(vector pts) { Plan::number_points = pts.size(); for(int i=0; i lns) { Plan::number_lines = lns.size(); Plan::number_points = 0; for(int i=0; i pts) { Plan::number_points = pts.size(); for(int i=0; i lns) { Plan::number_lines = lns.size(); Plan::number_points = 0; for(int i=0; i pts) { Plan::number_points += pts.size(); for(int i=0; i lns) { Plan::number_lines += lns.size(); for(int i=0; i Plan::GetPoints() { return Plan::points; } vector Plan::GetLinesP() { return Plan::points; } vector Plan::GetLinesL() { return Plan::lines; } vector Plan::GetPlanP() { return Plan::planP; } vector Plan::GetPlanL() { return Plan::planL; } Point Plan::GetPerp() { return Plan::perp; } Point Plan::GetCenter() { return Plan::center; } bool Plan::CheckPoint(Point P1) { bool cp = false; Algebra alg; Math math; if(math.Precision(math.Abs(alg.scalar_product(Line(center,P1),Line(Point(0.0,0.0,0.0),Plan::perp))),Plan::precision)==0.0) cp = true; return cp; } bool Plan::CheckCoplanarity() { bool cp = false; Plan::Precision(); switch (Plan::points.size()) { case 0: case 1: case 2: cout<<"Error: No plan inserted for coplanarity check!"< vp; Plan::center = Point(0.0,0.0,0.0); for(int i=0; i(Plan::number_points); //cout<<"-->"<(Plan::perps.size()); }; Plan::angles_perp = Angles(perp.GetPoint()); } void Plan::Precision() { Math math; Plan::precision = math.precision; }