VS:Centroid: Difference between revisions
Jump to navigation
Jump to search
(remark: centroid returns mm, added example) |
m (Transfer Orso to _c_) |
||
(One intermediate revision by the same user not shown) | |||
Line 41: | Line 41: | ||
----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ||
<remark> | <remark> | ||
([[User: | ([[User:CBM-c-|_c_]] 2016.04.18): This returns mm, so convert the values into current units: | ||
<code lang="vss"> | <code lang="vss"> | ||
IF Centroid(h, c.x, c.y) THEN BEGIN | IF Centroid(h, c.x, c.y) THEN BEGIN | ||
{ centroid | { centroid returns mm } | ||
c.x := c.x * GetPrefReal(152) / 25.4; | c.x := c.x * GetPrefReal(152) / 25.4; | ||
c.y := c.y * GetPrefReal(152) / 25.4; | c.y := c.y * GetPrefReal(152) / 25.4; |
Latest revision as of 05:28, 30 December 2020
.VectorScript|VectorScript ..VS:Function Reference|Function Reference ..VS:Function_Reference_Appendix|Appendix
Description
Returns the centroid of the object. Returns false if an unsupported object type is supplied.
FUNCTION Centroid(
h :HANDLE;
VAR x :REAL;
VAR y :REAL) : BOOLEAN;
def vs.Centroid(h): return (BOOLEAN, x, y)
Parameters
h HANDLE x REAL y REAL
Remarks
(_c_ 2016.04.18): This returns mm, so convert the values into current units:
IF Centroid(h, c.x, c.y) THEN BEGIN
{ centroid returns mm }
c.x := c.x * GetPrefReal(152) / 25.4;
c.y := c.y * GetPrefReal(152) / 25.4;
END;
Version
Availability: from Vectorworks 2014