00001
00002 #include "pop_point_3d.h"
00003
00004
00005 #include <vcl_iostream.h>
00006
00007
00008
00009 pop_point_3d::pop_point_3d(pop_vertex *coordinate_system,vcl_vector<pop_parameter*> ¶ms):
00010 vgl_point_3d<double>(params[0]->value_,params[1]->value_,params[2]->value_),
00011 pop_geometric_object(coordinate_system,params)
00012 {
00013 this->update();
00014 }
00015
00016
00017 pop_point_3d::pop_point_3d(pop_vertex *coordinate_system,double x, double y, double z):
00018 vgl_point_3d<double>(x,y,z),
00019 pop_geometric_object(coordinate_system)
00020 {
00021 }
00022
00023
00024 pop_point_3d::~pop_point_3d()
00025 {
00026 }
00027
00028
00029
00030 void pop_point_3d::update()
00031 {
00032 vgl_point_3d<double>::set(params_[0]->value_,params_[1]->value_,params_[2]->value_);
00033 }
00034
00035
00036 double pop_point_3d::cost(pop_geometric_object *other)
00037 {
00038 pop_point_3d *p = other->cast_to_pop_point_3d();
00039
00040 if (p->coordinate_system_ != this->coordinate_system_) {
00041 vcl_cout << "Warning the systems do not match\n";
00042 }
00043
00044 if (p)
00045 {
00046
00047 double dx = (this->x() - p->x());
00048 double dy = (this->y() - p->y());
00049 double dz = (this->z() - p->z());
00050
00051 double residule = dx*dx + dy*dy + dz*dz;
00052 return residule;
00053 }
00054 return 0;
00055 }