Skip to content

Draw Line in renderer2D in xtk library #225

Description

@chiliblast

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);

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions