### Author Topic: Scaling an object (Self Created)  (Read 1395 times)

#### sushobhit

• long
• Posts: 109
• future is now
##### Scaling an object (Self Created)
« on: August 11, 2016, 07:10:28 am »

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

« Last Edit: August 11, 2016, 07:19:07 am by sushobhit »

#### sushobhit

• long
• Posts: 109
• future is now
##### Re: Scaling an object (Self Created)
« Reply #1 on: August 11, 2016, 07:20:50 am »
// Front

// Back

// Upper

// Lower

// Left

// Right

#### sushobhit

• long
• Posts: 109
• future is now
##### Re: Scaling an object (Self Created)
« Reply #2 on: August 11, 2016, 07:22:01 am »
// Connectors

//Fillers

sample.build();

#### EgonOlsen

• Posts: 12092
##### Re: Scaling an object (Self Created)
« Reply #3 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.

#### sushobhit

• long
• Posts: 109
• future is now
##### Re: Scaling an object (Self Created)
« Reply #4 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.

« Last Edit: August 11, 2016, 12:19:53 pm by sushobhit »