[ Prev | Index | Next ]
Japanese English

Scaling 3D Objects

This section covers how to scale (enlarge or shrink) models and polygons.

Scaling a Model

To scale a model, use the scaleModel(...) function.

- Function Format -

void scaleModel (
  int modelID,
  float sx, float sy, float sz
)

Arguments:

  • modelID: Specifies the ID of the model to be scaled.
  • sx, sy, sz: Specify the scale factors for the X, Y, and Z directions respectively. A value greater than 1.0 enlarges the model, while a value less than 1.0 shrinks it. To keep the original size in a direction, use 1.0.

Scaling a Polygon

To scale a polygon, use the scalePolygon(...) function.

- Function Format -

void scalePolygon (
  int polygonID,
  float sx, float sy, float sz
)

Arguments:

  • polygonID: Specifies the ID of the polygon to be scaled.
  • sx, sy, sz: Specify the scale factors for the X, Y, and Z directions respectively. A value greater than 1.0 enlarges the polygon, while a value less than 1.0 shrinks it. To keep the original size in a direction, use 1.0.

Example Program

Let's place a sphere model and stretch it by a factor of 2 along the Z-axis. Write and run the following code:


import graphics3d.Graphics3DFramework;
import Graphics3D;

// Function called at the start of the program
void onStart ( int rendererID ) {

	// Optional: Set window size and background color
	setWindowSize( 800, 600 );
	setBackgroundColor( 0, 0, 0, 255 );


	// Create and place an axis model
	int axis = newAxisModel( 3.0, 3.0, 3.0 );
	mountModel( axis, rendererID );

	// Create and place a sphere model
	int sphere = newSphereModel( 1.0, 1.0, 1.0, 10, 7 );
	mountModel( sphere, rendererID );

	// Stretch the sphere 2x in the Z direction
	scaleModel( sphere, 1.0, 1.0, 2.0 );
}
Sample.vcssl

When you run this program, a white sphere will appear on a black background. The sphere is stretched 2x in the Z direction.

Execution Result
Execution Result
The sphere model appears scaled along the Z-axis.


Author of This Article

Fumihiro Matsui
[ Founder of RINEARN, Doctor of Science (Physics), Applied Info Tech Engineer ]
Develops VCSSL, RINEARN Graph 3D and more. Also writes guides and articles.

Translation Cooperator

ChatGPT AIs
[ GPT-3.5, 4, 5, 5.1 ]
We greatly appreciate the cooperation of ChatGPT AIs in translating this article.


Sponsored Link



Japanese English
Index
[ Prev | Index | Next ]
News From RINEARN
* VCSSL is developed by RINEARN.

Exevalatorv2.4Released—MCPSupportAdded,NowUsableasanAICalculationTool
2025-11-15 - We'vereleasedExevalatorv2.4,ourexpression-evaluationlibrary.Startingwiththisversion,itsupportsMCP,makingitusableasacalculationtoolforAIassistants.

Exevalatorv2.3Released—NowUsablefromPython
2025-11-04 - We'vereleasedExevalatorv2.3.Startingwiththisversion,youcannowuseitfromPython!WithgrowingdemandaroundAItooldevelopmentinmind,wesharethedetailshere.

ExevalatorUpdated—EasyJapaneseLocalizationforErrorMessages
2025-10-31 - Exevalator2.2.2isout.YoucannowlocalizeerrormessagestoJapanesewithasimplecopy-and-paste,andwe'veincludedseveralbugfixesandminorparseradjustments.

InsideRINPnOnline:ArchitectureOverview
2025-10-22 - AninsidelookatthearchitectureoftherecentlylaunchedonlineversionoftheRINPnscientificcalculator.It'sopensource,soyoucanfreelymodifyandreuseittobuildyourownwebcalculator(maybe!).

MeetRINPnOnline:UsetheScientificCalculatorAnywhere,Instantly
2025-10-21 - RINPn,thefreescientificcalculator,nowhasanonlineversionyoucanuseinstantlyinyourbrowser—onbothPCandsmartphones.Readtheannouncementfordetails.

TheVCSSLSupportAIisHere!—RequiresaChatGPTPlusAccountforPracticalPerformance
2025-08-19 - AnewAIassistantfortheVCSSLprogramminglanguageisheretoansweryourquestionsandhelpwithcoding.ThisarticleexplainshowtouseitandshowcasesplentyofrealQ&Aandgeneratedcodeexamples.

EnglishDocumentationforOurSoftwareandVCSSLIsNowNearlyComplete
2025-06-30 - We'rehappytoannouncethatthelarge-scaleexpansionofourEnglishdocumentationwiththesupportofAI—aprojectthatbegantwoyearsago—hasnowreacheditsinitialtargetmilestone.

VCSSL3.4.52Released:EnhancedIntegrationwithExternalProgramsandMore
2025-05-25 - Thisupdateintroducesenhancementstotheexternalprogramintegrationfeatures(e.g.,forrunningC-languageexecutables).Severalotherimprovementsandfixesarealsoincluded.Detailsinside.