[Bf-python] Mathutils additions
Joseph Gilbert
models at paposo.com
Sat Jul 17 13:55:35 CEST 2004
You can add a vector distance formula if you'd like however, the distance
between 2 vec can be calculated already by subracting 2 vectors and printing
the length of the resultant vector:
vec3 = vec1 - vec2
print vec3.length
-----Original Message-----
From: bf-python-admin at blender.org [mailto:bf-python-admin at blender.org]On
Behalf Of Campbell Barton
Sent: Saturday, July 17, 2004 6:03 AM
To: bf-python at blender.org
Subject: Re: [Bf-python] Mathutils additions
Hi, The method is as follows in C
length = sqrt(pow((v2[0] - v1[0]),2) + pow((v2[1] - v1[1]),2) +
pow((v2[2] - v1[2]),2) );
This measures the real length (not the quick and disty method)
- Area of a triangle
p = el1 + el2 + el3; /* Get the perimeter from the edge lengths */
area = 0.25 * sqrt(p * ((p-el1)*(p-el2)*(p-el3)));
- Cam
Jonathan Merritt wrote:
> Hi Campbell,
>
> Campbell Barton wrote:
>
>> Mathutils.getVecDist(vecA, vecB) # measures the distance in 3d space
>> between 2 vectors
>
>
>
> Just a question about this one: do you mean the Euclidean distance
> between two points? ie:
> || A - B ||
> Where A and B are the Cartesian locations of a pair of points?
>
>> The names could realy be anything but Im interested to know if I
>> coded this weather people would use it.
>
>
>
> Definitely! :-) I'd just be picky about the name getVecDist() - I'd
> rather see it named getPointDist() or something.
> A "distance between two vectors" is a less well-defined concept, since
> it really only applies in the form above if the two vectors exist in
> the same coordinate system. Sure, points must *also* be in the same
> coordinate system, but IMHO, that's more obvious. There are many,
> many cases in 3D graphics where vectors are specified in the same
> rotational coordinate frame (so you can take dot and cross products,
> etc.), but they have an implicit translation offset (eg: the camera
> view vector and a normal to a face, to pick an example off the top of
> my head).
>
> Jonathan Merritt.
> _______________________________________________
> Bf-python mailing list
> Bf-python at blender.org
> http://www.blender.org/mailman/listinfo/bf-python
>
>
--
Campbell J Barton
133 Hope Street
Geelong West, Victoria 3218 Australia
URL: http://www.metavr.com
e-mail: cbarton at metavr.com
phone: AU (03) 5229 0241
_______________________________________________
Bf-python mailing list
Bf-python at blender.org
http://www.blender.org/mailman/listinfo/bf-python
More information about the Bf-python
mailing list