Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draw Line in renderer2D in xtk library #225

Open
chiliblast opened this issue Jan 16, 2022 · 0 comments
Open

Draw Line in renderer2D in xtk library #225

chiliblast opened this issue Jan 16, 2022 · 0 comments

Comments

@chiliblast
Copy link

I am trying to draw a line on click in canvas in renderer3D and renderer2D, after loading dicom files. Line does get drawing in renderer3D, but not in renderer2D. How can I get line in renderer2D

// create and initialize a 3D renderer
this.r_3D = new X.renderer3D();
this.r_3D.container = canvas3D;
this.r_3D.init();

// create and initialize a 2D renderer
this.r_X = new X.renderer2D();
this.r_X.container = canvasX;
this.r_X.orientation = 'X';
this.r_X.init();

click(e:any) {

let obj = new X.object();

obj.points = new X.triplets(6);
obj.normals = new X.triplets(6);
//obj.colors = new X.triplets(6);

// and set the type to POINTS
obj.type = 'LINES';

obj.points.add(e.offsetX, e.offsetY, 0);
obj.points.add(e.offsetX+100, e.offsetY+200, 200);
this.r_3D.add(obj);
this.r_2D.add(obj);

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant