# Help with translating points from Processing for use in Grasshopper

**URL:** <https://discourse.processing.org/t/help-with-translating-points-from-processing-for-use-in-grasshopper/1747>\
**Category:** Libraries\
**Created:** [July 13, 2018, 4:56pm UTC](https://discourse.processing.org/t/help-with-translating-points-from-processing-for-use-in-grasshopper/1747 "2018-07-13T16:56:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gegardner](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gegardner/32/742_2.png) [@gegardner](https://discourse.processing.org/u/gegardner)\
**Post date:** [July 13, 2018, 4:56pm UTC](https://discourse.processing.org/t/help-with-translating-points-from-processing-for-use-in-grasshopper/1747/1 "2018-07-13T16:56:45Z")

</div>

Hi, can someone help with what is likely a simple question from an inexperienced processing user.

I would like to import raw point data from face osc using this method:

> <https://github.com/CreativeInquiry/FaceOSC-Templates/blob/a68f00d02955cbd09dc027f9b65012a18cc9acf2/processing/FaceOSCRawReceiver/FaceOSCRawReceiver.pde>

I would like to translate the coordinate system for x,y, and z and print to the PrintWriter stream as a vector to be read using grasshopper’s Import coordinates node.

but I am unclear on how to apply it to the array coming from face osc.

---

<div class="post-metadata">

**Author:** ![bagginstyrone](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/bagginstyrone/32/12600_2.png) [@bagginstyrone](https://discourse.processing.org/u/bagginstyrone)\
**Post date:** [January 9, 2023, 3:22am UTC](https://discourse.processing.org/t/help-with-translating-points-from-processing-for-use-in-grasshopper/1747/2 "2023-01-09T03:22:19Z")

</div>

To translate the coordinate system for the x, y, and z values coming from FaceOSC, you can apply a transformation matrix to each point in the rawArray. A transformation matrix is a mathematical representation of a geometric transformation such as a translation, rotation, or scaling.

To apply a transformation matrix to a point (x, y, z), you can multiply the matrix and the point as follows:

```auto
float[] transformedPoint = {
  x * matrix[0] + y * matrix[4] + z * matrix[8] + matrix[12],
  x * matrix[1] + y * matrix[5] + z * matrix[9] + matrix[13],
  x * matrix[2] + y * matrix[6] + z * matrix[10] + matrix[14],
  x * matrix[3] + y * matrix[7] + z * matrix[11] + matrix[15]
};

```

Here, `matrix` is the transformation matrix and `transformedPoint` is the transformed point.

To write the transformed point to a PrintWriter stream as a vector, you can use the `write()` method of the PrintWriter class. For example:

```auto
PrintWriter writer = new PrintWriter(new FileOutputStream("output.txt"));
writer.write(transformedPoint[0] + " " + transformedPoint[1] + " " + transformedPoint[2]);
writer.close();

```

This will write the x, y, and z values of the transformed point to a file called “output.txt” as a space-separated vector.
