本文整理汇总了Python中mathutils.Matrix.normalized方法的典型用法代码示例。如果您正苦于以下问题:Python Matrix.normalized方法的具体用法?Python Matrix.normalized怎么用?Python Matrix.normalized使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mathutils.Matrix
的用法示例。
在下文中一共展示了Matrix.normalized方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Line
# 需要导入模块: from mathutils import Matrix [as 别名]
# 或者: from mathutils.Matrix import normalized [as 别名]
#.........这里部分代码省略.........
"""
return atan2(u.x * v.y - u.y * v.x, u.x * v.x + u.y * v.y)
def delta_angle(self, last):
"""
signed delta angle between end of line and start of this one
this value is object's a0 for segment = self
"""
if last is None:
return self.angle
return self.signed_angle(last.straight(1, 1).v, self.straight(1, 0).v)
def normal(self, t=0):
"""
2d Line perpendicular on plane xy
at position t in current segment
lie on the right side
p1
|--x
p0
"""
return Line(self.lerp(t), self.cross_z)
def sized_normal(self, t, size):
"""
2d Line perpendicular on plane xy
at position t in current segment
and of given length
lie on the right side when size > 0
p1
|--x
p0
"""
return Line(self.lerp(t), size * self.cross_z.normalized())
def lerp(self, t):
"""
3d interpolation
"""
return self.p + self.v * t
def intersect(self, line):
"""
2d intersection on plane xy
return
True if intersect
p: point of intersection
t: param t of intersection on current line
"""
c = line.cross_z
d = self.v.dot(c)
if d == 0:
return False, 0, 0
t = c.dot(line.p - self.p) / d
return True, self.lerp(t), t
def intersect_ext(self, line):
"""
same as intersect, but return param t on both lines
"""
c = line.cross_z
d = self.v.dot(c)
if d == 0:
return False, 0, 0, 0
dp = line.p - self.p
c2 = self.cross_z