I wasn’t  fully aware how sin and cos where effecting the position in the fist drawings code, but after finding out about the Spherical Coordinates in maths, It all makes much more sense now. It helps you work objects drawing in 3 diminutional space. [link]

The formulas:

x=r \, \cos\phi \, \sin\theta \quad

y=r \, \sin\phi \, \sin\theta \quad

z=r \, \cos\theta \quad

This is what it looks like in my code:

 float getEndPointX() {
    return (x + r*cos(phi/57.3)*sin(theta/57.3)); //
  }

  float getEndPointY() {
    return (y + r*sin(phi/57.3)*sin(theta/57.3));
  }

  float getEndPointZ(){

  return z + r*cos(theta/57.3);
    }
}

After making these changes I’m now about to work out the position of the z plane. The images it draws are almost the same as the 2d drawings. Without been able to work out the rotation of the lines I’ll not been able to fully see the image from any other angle  to check if its drawing. I’ve been researching for different libraries which will be able to draw vector shapes, like tubes to make the drawings, I think this’ll be the only way to move forward now.

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>