[Bf-committers] python mathutils api update proposal

Tom Edwards contact at steamreview.org
Thu Feb 3 14:04:40 CET 2011


Could we please have maths operator (i.e. * / +) support for eulers? You 
can't do anything with them currently, you have to cast to vector then 
back again!

On 03/02/2011 11:08, Campbell Barton wrote:
> Here are some proposed changes to the mathutils API I'd like to make
> to avoid some confusing aspects of the api since its now used for all
> RNA math types and GameEngine I think it would be good to make
> improvements in this area.
>
> Proposal:
>    http://wiki.blender.org/index.php/Dev:2.5/Source/Python/Mathutils
>
> If this is acceptable I can make these changes and update scripts.
>
> I'm keeping a log of all mathutils changes since 2.4x in mathutils.c
>
> To get up to speed on changes so far:
>
> /* Note: Changes to Mathutils since 2.4x
>   * use radians rather then degrees
>   * - Mathutils.Vector/Euler/Quaternion(), now only take single
> sequence arguments.
>   * - Mathutils.MidpointVecs -->  vector.lerp(other, fac)
>   * - Mathutils.AngleBetweenVecs -->  vector.angle(other)
>   * - Mathutils.ProjectVecs -->  vector.project(other)
>   * - Mathutils.DifferenceQuats -->  quat.difference(other)
>   * - Mathutils.Slerp -->  quat.slerp(other, fac)
>   * - Mathutils.Rand: removed, use pythons random module
>   * - Mathutils.RotationMatrix(angle, size, axis_flag, axis) -->
> Mathutils.RotationMatrix(angle, size, axis); merge axis&  axis_flag
> args
>   * - Matrix.scalePart -->  Matrix.scale_part
>   * - Matrix.translationPart -->  Matrix.translation_part
>   * - Matrix.rotationPart -->  Matrix.rotation_part
>   * - mathutils.Matrix.Shear(plane, fac, size), now takes a pair of
> floats for 3x3 or 4x4 shear factor.
>   * - toMatrix -->  to_matrix
>   * - toEuler -->  to_euler
>   * - toQuat -->  to_quat
>   * - Vector.toTrackQuat -->  Vector.to_track_quat
>   * - Quaternion * Quaternion -->  cross product (not dot product)
>   * - Euler.rotate(angle, axis) -->  Euler.rotate_axis(axis, angle)
>   * - Euler.unique() *removed*, not a standard function only toggled
> different rotations.
>   *
>   * moved into class functions.
>   * - Mathutils.RotationMatrix ->  mathutils.Matrix.Rotation
>   * - Mathutils.ScaleMatrix ->  mathutils.Matrix.Scale
>   * - Mathutils.ShearMatrix ->  mathutils.Matrix.Shear
>   * - Mathutils.TranslationMatrix ->  mathutils.Matrix.Translation
>   * - Mathutils.OrthoProjectionMatrix ->  mathutils.Matrix.OrthoProjection
>   *
>   * Moved to Geometry module: Intersect, TriangleArea, TriangleNormal,
> QuadNormal, LineIntersect
>   * - geometry.Intersect ->  intersect_ray_tri
>   * - geometry.ClosestPointOnLine ->  intersect_point_line
>   * - geometry.PointInTriangle2D ->  intersect_point_tri_2d
>   * - geometry.PointInQuad2D ->  intersect_point_quad_2d
>   * - geometry.LineIntersect ->  intersect_line_line
>   * - geometry.LineIntersect2D ->  intersect_line_line_2d
>   * - geometry.BezierInterp ->  interpolate_bezier
>   * - geometry.TriangleArea ->  area_tri
>   * - geometry.QuadNormal, TriangleNormal ->  normal
>   * - geometry.PolyFill ->  tesselate_polygon
>   * - geometry.BoxPack2D ->  box_pack_2d
>   * - geometry.BarycentricTransform ->  barycentric_transform
>   */
>


More information about the Bf-committers mailing list