Quantcast
Channel: Library Questions - Processing 2.x and 3.x Forum
Viewing all articles
Browse latest Browse all 2896

Line between a 2D and 3D point

$
0
0

Dear all,

I as a part of a 3D interface that I'm working on, I would like to be able to create a line between a 2D point and 3D point. In order to understand my question better, here is a simplified code:

import peasy.*;
PeasyCam cam;

void setup() {
  size(1600, 900, P3D);
  smooth();
  frameRate(60);
  lights();
  cam = new PeasyCam(this, 100);
}

void draw() {
  background(255);
  cam.beginHUD();
  rect(0, 0, 50, 50);
  cam.endHUD();

  translate(mouseX, mouseY);
  box(10,10,10);
}

I would like that a line would be connecting a 2D point (for example the lower right corner of the 2D square) with one of the corners (3D point) of the cube. So even if the cube would be rotating, the line would be connecting both points by constantly updating itself.

Has anyone an idea how this could be done? Maybe by defining 2 PVectors, one as a 2D and the other as 3D?

Any help is highly appreciated. Regards,

L


Viewing all articles
Browse latest Browse all 2896

Trending Articles