[Bf-committers] python mathutils api update proposal

Martin Poirier theeth at yahoo.com
Thu Feb 3 23:57:48 CET 2011


Because we use row vectors, the other direction doesn't make sense.

An euler triplet is not a vector, pretending it is would be very wrong.

I would much prefer something like euler.rotate, it seriously reduces potential confusion.

Martin

--- On Thu, 2/3/11, Campbell Barton <ideasman42 at gmail.com> wrote:

> From: Campbell Barton <ideasman42 at gmail.com>
> Subject: Re: [Bf-committers] python mathutils api update proposal
> To: "bf-blender developers" <bf-committers at blender.org>
> Received: Thursday, February 3, 2011, 5:51 PM
> At the moment you can only do:
> Vector() * Matrix() --> Vector()
> So it makes sense that Euler() * Matrix() --> Euler(),
> matching the
> order of the original euler, but if nobody else is doing
> this it might
> be better to have this as a convenience method.
> 
> Something like: eul = euler.rotate(matrix/quat/euler).
> 
> On Thu, Feb 3, 2011 at 10:47 PM, Martin Poirier <theeth at yahoo.com>
> wrote:
> > How would it decide if the return value is euler or
> matrix? The order of argument (that seems dangerous since
> multiplication is not commutative).
> >
> > Martin
> >
> > --- On Thu, 2/3/11, Tom Edwards <contact at steamreview.org>
> wrote:
> >
> >> From: Tom Edwards <contact at steamreview.org>
> >> Subject: Re: [Bf-committers] python mathutils api
> update proposal
> >> To: "bf-blender developers" <bf-committers at blender.org>
> >> Received: Thursday, February 3, 2011, 5:31 PM
> >> That is more or less what I do. There
> >> is no reason I can see why it
> >> shouldn't happen implicitly.
> >>
> >> On 03/02/2011 10:19, Campbell Barton wrote:
> >> > Euler() * 0.5, makes sense to halve rotation,
> but from
> >> reading down
> >> > you're mainly interested in: Euler() *
> Matrix().
> >> >
> >> > This could be supported, internally doing...
> >> >    eul = Euler()
> >> >    (eul.to_matrix() *
> >> Matrix()).to_euler(eul.order)
> >> >
> >> > I'd be interested to know if there are many
> other math
> >> libs which do
> >> > Euler * Matrix since there are enough
> de-facto
> >> standard with
> >> > C++/python libs like mathutils I rather not
> define new
> >> ones.
> >> >
> >> > On Thu, Feb 3, 2011 at 1:04 PM, Tom
> Edwards<contact at steamreview.org>
> >> wrote:
> >> >> 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
> >> >>>    */
> >> >>>
> >> >>
> _______________________________________________
> >> >> Bf-committers mailing list
> >> >> Bf-committers at blender.org
> >> >> http://lists.blender.org/mailman/listinfo/bf-committers
> >> >>
> >> >
> >> >
> >> _______________________________________________
> >> Bf-committers mailing list
> >> Bf-committers at blender.org
> >> http://lists.blender.org/mailman/listinfo/bf-committers
> >>
> >
> >
> > _______________________________________________
> > Bf-committers mailing list
> > Bf-committers at blender.org
> > http://lists.blender.org/mailman/listinfo/bf-committers
> >
> 
> 
> 
> -- 
> - Campbell
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at blender.org
> http://lists.blender.org/mailman/listinfo/bf-committers
> 




More information about the Bf-committers mailing list