#include "stdafx.h"
#include <iostream>
using namespace std;
struct Point
{
double x;
double y;
double z;
};
int main(int argc, char** argv) {
//translate to the center
struct Point max_bound = {3,3,3};
struct Point min_bound = {0.5,0.5,0.5};
double middlex, middley, middlez;
middlex = (max_bound.x + min_bound.x) / 2;
middley = (max_bound.y + min_bound.y) / 2;
middlez = (max_bound.z + min_bound.z) / 2;
struct Point point_set[] = { {2,3,3},{1,2,3},{3,3,3},{2,3,2},{0.5,0.5,0.5} };
for (int i = 0; i < 5; i ++) {
point_set[i].x = point_set[i].x - middlex;
point_set[i].y = point_set[i].y - middley;
point_set[i].z = point_set[i].z - middlez;
}
//scale based on x range
double scalecoe = (max_bound.x - min_bound.x) / 2;
for (int i = 0; i < 5; i++) {
point_set[i].x = point_set[i].x / scalecoe;
point_set[i].y = point_set[i].y / scalecoe;
point_set[i].z = point_set[i].z / scalecoe;
}
for (int i = 0; i < 5; i++) {
printf("%lf,%lf,%lf \n",point_set[i].x, point_set[i].y, point_set[i].z);
}
return 0;
}