Permalink
Browse files

Center Text Primitive by way of BOUNDING-BOX

Last version didn't employ any meaningful centering strategy.
First Attempt at Fix use vertex weights and was not ideal.

NOTE: Text Primitives should be centered according to bounding box
that surrounds the text primitive being created.
  • Loading branch information...
1 parent 1a55e08 commit d9e358e481da8f7deca923732d5d1d29e60e1a42 Mark Whittemore committed Dec 29, 2011
Showing with 1 addition and 1 deletion.
  1. +1 −1 plugins_src/primitives/wpc_tt.erl
@@ -123,7 +123,7 @@ trygen(File, Text, Nsubsteps) ->
Ttf = parsett(TTFpart),
Pa = getpolyareas(Text, Ttf, Nsubsteps),
{Vs0,Fs} = polyareas_to_faces(Pa),
- {CX,CY,CZ} = e3d_vec:average(Vs0),
+ {CX,CY,CZ} = e3d_vec:average(tuple_to_list(e3d_bv:box(Vs0))),
Vs = [{X-CX,Y-CY,Z-CZ} || {X,Y,Z} <- Vs0],
{new_shape,"text",Fs,Vs}; % Would be nicer centered by centroid
_ -> {error, ?__(1,"Can't find TrueType section in ") ++ File}

0 comments on commit d9e358e

Please sign in to comment.