# www.jpct.net

## jPCT-AE - a 3d engine for Android => Support => Topic started by: sushobhit on August 11, 2016, 07:10:28 am

Title: Scaling an object (Self Created)
Post by: sushobhit on August 11, 2016, 07:10:28 am
:D

Can anybody plz help with this problem I am stuck with .
I have created a simple cube using
The problem is I DK how to add scaling capability to it .What are the vec calcs to be applied to make it scalable . Plz .

Here is the code :

SimpleVector upperLeftFront=new SimpleVector(-0.8,-0.8f,-1);
SimpleVector upperRightFront=new SimpleVector(0.8,-0.8f,-1);
SimpleVector lowerLeftFront=new SimpleVector(-0.8,0.8f,-1);
SimpleVector lowerRightFront=new SimpleVector(0.8,0.8f,-1);

SimpleVector upperLeftBack = new SimpleVector( -0.8, -0.8, 1);
SimpleVector upperRightBack = new SimpleVector(0.8, -0.8, 1);
SimpleVector lowerLeftBack = new SimpleVector( -0.8, 0.8, 1);
SimpleVector lowerRightBack = new SimpleVector(0.8, 0.8, 1);

SimpleVector upperLeftLeft=new SimpleVector(-1,-0.8,0.8 );
SimpleVector upperRightLeft=new SimpleVector(-1,-0.8,-0.8 );
SimpleVector lowerLeftLeft=new SimpleVector(-1,0.8,0.8 );
SimpleVector lowerRightLeft=new SimpleVector(-1,0.8,-0.8 );

SimpleVector upperLeftRight = new SimpleVector( 1, -0.8, -0.8 );
SimpleVector upperRightRight = new SimpleVector(1, -0.8, 0.8 );
SimpleVector lowerLeftRight = new SimpleVector( 1, 0.8, -0.8 );
SimpleVector lowerRightRight = new SimpleVector(1, 0.8, 0.8 );

SimpleVector upperLeftUp=new SimpleVector(-0.8,-1,0.8 );
SimpleVector upperRightUp=new SimpleVector(0.8,-1,0.8 );
SimpleVector lowerLeftUp=new SimpleVector(-0.8,-1,-0.8 );
SimpleVector lowerRightUp=new SimpleVector(0.8,-1,-0.8 );

SimpleVector upperLeftBottom = new SimpleVector( -0.8, 1, 0.8 );
SimpleVector upperRightBottom = new SimpleVector(0.8, 1, 0.8 );
SimpleVector lowerLeftBottom = new SimpleVector( -0.8, 1, -0.8 );
SimpleVector lowerRightBottom = new SimpleVector(0.8, 1, -0.8 );

Object3D sample = new Object3D(44);

Title: Re: Scaling an object (Self Created)
Post by: sushobhit on August 11, 2016, 07:20:50 am
// Front

// Back

// Upper

// Lower

// Left

// Right

Title: Re: Scaling an object (Self Created)
Post by: sushobhit on August 11, 2016, 07:22:01 am
// Connectors

//Fillers

sample.build();
Title: Re: Scaling an object (Self Created)
Post by: EgonOlsen on August 11, 2016, 08:15:10 am
By calling setScale(...) on the cube? Or does it have to be permanent in the vertors? If so, just multiply every SimpleVector with a constant (SimpleVector.scalarMul()).
Or for non-uniform scaling, multiply the x,y and z coordinates with different constants.
Title: Re: Scaling an object (Self Created)
Post by: sushobhit on August 11, 2016, 12:05:36 pm
Hi Egon ,

It's working I wanted permanent scaling so I used the second method .

P.S : Just downloaded Naroth from Play Store , just want to congratulate you {Sir} for such excellent graphics and game . As I am following this forum for about 2years now I know how much hard work you have put in it.
:)