# Parallel lines in 3D space

**URL:** <https://discourse.processing.org/t/parallel-lines-in-3d-space/41801>\
**Category:** Coding Questions\
**Created:** [April 23, 2023, 2:57pm UTC](https://discourse.processing.org/t/parallel-lines-in-3d-space/41801 "2023-04-23T14:57:48Z")\
**Posts on this page:** 1\
**Showing post:** 18

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [April 26, 2023, 10:55am UTC](https://discourse.processing.org/t/parallel-lines-in-3d-space/41801/18 "2023-04-26T10:55:29Z")

</div>

Hello @paulstgeorge,

Thanks for this topic! Refreshing my math and Processing helps visualize concepts… especially cross and dot products.

I gleaned some concepts to create local planes from:

> [@Points on the surface of a Sphere using beginShape(POINTS or QUADS)](https://discourse.processing.org/t/points-on-the-surface-of-a-sphere-using-beginshape-points-or-quads/34425/9):
>
> I’m happy now! slight_smile I use the cross product to calculate a local coordinate space perpendicular to the sphere. I add all vertices in setup() to a PShape and only call shape(dots) to draw them all at once in draw(). I hope it is useful for others. Best wishes, Rick float dotRadius = 4; float sphereRadius = 250; PShape dots; void setup() { size(700, 700, P3D); dots = createShape(GROUP); for (int i=0; i\<1000; i++) { PVector n = PVector.random3D().mult(sphereRadiu…

And was able to create infinite parallel lines:

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/3X/e/1/e11f72371b748a20a139d493a56a2efc573c27e2.png)

Other resources I found useful:

> **[3D Rotations in Processing (Vectors, Matrices, Quaternions)](https://behreajj.medium.com/3d-rotations-in-processing-vectors-matrices-quaternions-10e2fed5f0a3)**
>
> This tutorial introduces how to rotate objects in 3D beyond Euler angles; to do this, it looks at the basics of matrices and quaternions…

> <https://math.stackexchange.com/questions/137362/how-to-find-perpendicular-vector-to-another-vector>

Can you draw a quick 2D sketch (paper or Processing) to illustrate what you are trying to achieve?

`:)`

---

_[View the full topic](https://discourse.processing.org/t/parallel-lines-in-3d-space/41801)._
