Midpoint of 2 vectors

Scripting in Blender with Python, and working on the API

Moderators: jesterKing, stiv

zappfinger
Posts: 7
Joined: Mon Dec 24, 2012 12:55 pm
Location: Breda, the Netherlands

Midpoint of 2 vectors

Postby zappfinger » Tue Dec 25, 2012 12:14 am

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

Mr.Yeah
Posts: 7
Joined: Mon Dec 24, 2012 1:41 pm

Postby Mr.Yeah » Tue Dec 25, 2012 6:30 pm

Do it yourself:

Code: Select all

def MidpointVecs(vec1, vec2):
    vec = vec1 + vec2
    vec = vec / 2
    return vec


cu
Mr.Yeah

zappfinger
Posts: 7
Joined: Mon Dec 24, 2012 12:55 pm
Location: Breda, the Netherlands

Postby zappfinger » Tue Dec 25, 2012 7:22 pm

Thanks,

I figured that out too..

Richard

CoDEmanX
Posts: 894
Joined: Sun Apr 05, 2009 7:42 pm
Location: Germany

Postby CoDEmanX » Wed Dec 26, 2012 9:09 pm

or use the built-in function for interpolation:

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


Return to “Python”

Who is online

Users browsing this forum: No registered users and 2 guests