Converting this definition to C# doesn't give the same outputs

How can I convert this script into C# while getting the same outputs ?
Definition.gh (6.5 KB)

somethings like this : ?
Definition.gh (4.9 KB)

Great efforts Jacques, the thing is that the outputted lines does not match the directions of the lines from the attached definition and I think its because of a difference in decimals between the center points and the pulled points which doesn’t make sense knowing that Point3d class doesn’t take decimals only doubles, if you can figure out the problem it would be much of help, much appreciated

I’m not sure I understand what you’re looking for.

What I have done is :

  • find the centre of gravity of the surface
  • project this point onto the surface, i.e. to the nearest edge for a point
  • create a 0.5m line from the centre of gravity in the direction of the projected point.

If the centre of gravity is on the surface, the projection of the point will be exactly on the same surface. So how do you find the right direction for your line?
In your example you have lines at the end that aren’t 0.5m long but longer, is that normal?

Get the attached and modify anything you want.

Definition._toCgh.gh (11.5 KB)