POV-Ray : Newsgroups : povray.general : Dimensions of Text objects Server Time
31 Oct 2024 06:04:08 EDT (-0400)
  Dimensions of Text objects (Message 1 to 2 of 2)  
From: Steaphany Waelder
Subject: Dimensions of Text objects
Date: 25 Dec 2005 14:10:01
Message: <web.43aeed721711602cdb1d7b250@news.povray.org>
Is there a way to derive the x and y (width and height) of text objects ? I
would like to know the complete string dimensions.

I am trying to center text on an object and knowing it's width would make
the job easier


Post a reply to this message

From: Alain
Subject: Re: Dimensions of Text objects
Date: 25 Dec 2005 14:20:28
Message: <43aef0fc$1@news.povray.org>
Steaphany Waelder nous apporta ses lumieres en ce 2005-12-25 14:05:
> Is there a way to derive the x and y (width and height) of text objects ? I
> would like to know the complete string dimensions.
> 
> I am trying to center text on an object and knowing it's width would make
> the job easier
> 
> 
Yes by using max_extent(OBJECT_IDENTIFIER) and min_extent(OBJECT_IDENTIFIER). It works
with any object.
#declare you text object with no rotation, feed it to max_ and min_extent, calculate
the mid point 
and translate your object as needed. If you need to rotate it, translate it by half
it's dimention 
(to center it around the origin), rotate, then translate to it's final position.

-- 
Alain
-------------------------------------------------
A critic is a man who knows the way, but can't drive the car.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.