Previous Thread  Next Thread

chat icon Midpoint of 2 vectors

zappfinger

Posted: Tue Dec 25, 2012 12:14 am
Joined: 24 Dec 2012
Posts: 7
I am trying to find the midpoint between 2 vertices (vectors).
It seems that mathutils used to have a function MidpointVecs, but now this does not exisr anymore?
I use Blender 2.5 and higher.

Richard
Reply with quote


Mr.Yeah

Posted: Tue Dec 25, 2012 6:30 pm
Joined: 24 Dec 2012
Posts: 7
Do it yourself:
Code:
def MidpointVecs(vec1, vec2):
    vec = vec1 + vec2
    vec = vec / 2
    return vec


cu
Mr.Yeah
Reply with quote


zappfinger

Posted: Tue Dec 25, 2012 7:22 pm
Joined: 24 Dec 2012
Posts: 7
Thanks,

I figured that out too..

Richard
Reply with quote


CoDEmanX

Posted: Wed Dec 26, 2012 9:09 pm
Joined: 05 Apr 2009
Posts: 680
or use the built-in function for interpolation:

vec1.lerp(vec2, 0.5)
_________________
I'm sitting, waiting, wishing, building Blender in superstition...
Reply with quote


 
Jump to:  
Powered by phpBB © 2001, 2005 phpBB Group