Translation

Translating a shape using transformation object

function build() {

    //create cylinder lying on the X-Z plane. 

    //You can verify it by returning solid before transformation
	let s1 = cadlib.cylinder({radius:5, height:1});

    //Move the shape on +Y axis by 10. 
    //Note: scaling factor is set to 1. 
	let xform = {
		position: new Vec3(0, 10, 0)
    };
    
    //create transformation object
    let t = cadlib.createTransformation(xform);
    
    //apply transform
    s1.transform(t, false);
    
    //return solid
    return s1;
    
    
}