﻿<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ja">
	<id>https://wiki.blender.jp/index.php?action=history&amp;feed=atom&amp;title=%E5%88%A9%E7%94%A8%E8%80%85%3AIdeasman42%2FMath</id>
	<title>利用者:Ideasman42/Math - 版の履歴</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.blender.jp/index.php?action=history&amp;feed=atom&amp;title=%E5%88%A9%E7%94%A8%E8%80%85%3AIdeasman42%2FMath"/>
	<link rel="alternate" type="text/html" href="https://wiki.blender.jp/index.php?title=%E5%88%A9%E7%94%A8%E8%80%85:Ideasman42/Math&amp;action=history"/>
	<updated>2026-06-18T04:04:16Z</updated>
	<subtitle>このウィキのこのページに関する変更履歴</subtitle>
	<generator>MediaWiki 1.31.0</generator>
	<entry>
		<id>https://wiki.blender.jp/index.php?title=%E5%88%A9%E7%94%A8%E8%80%85:Ideasman42/Math&amp;diff=103909&amp;oldid=prev</id>
		<title>Yamyam: 1版 をインポートしました</title>
		<link rel="alternate" type="text/html" href="https://wiki.blender.jp/index.php?title=%E5%88%A9%E7%94%A8%E8%80%85:Ideasman42/Math&amp;diff=103909&amp;oldid=prev"/>
		<updated>2018-06-28T19:42:11Z</updated>

		<summary type="html">&lt;p&gt;1版 をインポートしました&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;ja&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← 古い版&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;2018年6月28日 (木) 19:42時点における版&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;ja&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(相違点なし)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Yamyam</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.blender.jp/index.php?title=%E5%88%A9%E7%94%A8%E8%80%85:Ideasman42/Math&amp;diff=103908&amp;oldid=prev</id>
		<title>wiki&gt;Ideasman42: /* Hex Root */</title>
		<link rel="alternate" type="text/html" href="https://wiki.blender.jp/index.php?title=%E5%88%A9%E7%94%A8%E8%80%85:Ideasman42/Math&amp;diff=103908&amp;oldid=prev"/>
		<updated>2012-01-02T14:45:33Z</updated>

		<summary type="html">&lt;p&gt;‎&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Hex Root&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新規ページ&lt;/b&gt;&lt;/p&gt;&lt;div&gt;=== Hex Root ===&lt;br /&gt;
A fun one, this is the 'hex', like the square, if you have a hexagon this is how to know the total number of hexagons in the center from the number on 1 side as well as the hex root.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import math&lt;br /&gt;
&lt;br /&gt;
def hex(x):&lt;br /&gt;
    a = (((x - 1.0) * 3.0) * x) + 1.0&lt;br /&gt;
    return a&lt;br /&gt;
&lt;br /&gt;
def hex_root(a):&lt;br /&gt;
    x = (3.0 + math.sqrt(9.0 - (12.0 * (1.0 - a)))) / 6.0&lt;br /&gt;
    return x&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or more info http://en.wikipedia.org/wiki/Centered_hexagonal_number&lt;br /&gt;
&lt;br /&gt;
=== Align Matrix Axis ===&lt;br /&gt;
Used this to create all possible axis flipping for blender python.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
from mathutils import Vector, Matrix&lt;br /&gt;
&lt;br /&gt;
def align_matrix(mat, axis, vec, eps=0.000001):&lt;br /&gt;
    if axis == 'X':&lt;br /&gt;
        ori = mat[2].copy()&lt;br /&gt;
        if abs(vec.dot(ori)) &amp;gt; (1.0 - eps):&lt;br /&gt;
            ori = mat[1].copy()&lt;br /&gt;
        x = vec&lt;br /&gt;
        y = ori.cross(x)&lt;br /&gt;
        z = x.cross(y)&lt;br /&gt;
    elif axis == 'Y':&lt;br /&gt;
        ori = mat[0].copy()&lt;br /&gt;
        if abs(vec.dot(ori)) &amp;gt; (1.0 - eps):&lt;br /&gt;
            ori = mat[2].copy()&lt;br /&gt;
        y = vec&lt;br /&gt;
        z = ori.cross(y)&lt;br /&gt;
        x = y.cross(z)&lt;br /&gt;
    elif axis == 'Z':&lt;br /&gt;
        ori = mat[1].copy()&lt;br /&gt;
        if abs(vec.dot(ori)) &amp;gt; (1.0 - eps):&lt;br /&gt;
            ori = mat[0].copy()&lt;br /&gt;
        z = vec&lt;br /&gt;
        x = ori.cross(z)&lt;br /&gt;
        y = z.cross(x)&lt;br /&gt;
&lt;br /&gt;
    mat[0] = x.normalized()&lt;br /&gt;
    mat[1] = y.normalized()&lt;br /&gt;
    mat[2] = z.normalized()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def world_transform(axis, up):&lt;br /&gt;
    &lt;br /&gt;
    axis_vec = Vector()&lt;br /&gt;
    up_vec = Vector()&lt;br /&gt;
&lt;br /&gt;
    axis_vec[ord(axis[-1]) - ord('X')] = -1.0 if axis.startswith('-') else 1.0&lt;br /&gt;
    up_vec[ord(up[-1]) - ord('X')] = -1.0 if up.startswith('-') else 1.0&lt;br /&gt;
&lt;br /&gt;
    mat = Matrix()&lt;br /&gt;
    mat = mat.to_3x3()&lt;br /&gt;
    mat.identity()&lt;br /&gt;
&lt;br /&gt;
    align_matrix(mat, 'Y', up_vec)&lt;br /&gt;
    align_matrix(mat, 'Z', axis_vec)&lt;br /&gt;
&lt;br /&gt;
    # print(mat)&lt;br /&gt;
    return mat&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
import bpy&lt;br /&gt;
# bpy.context.object.matrix_world = world_transform('Z', '-X').to_4x4()&lt;br /&gt;
opts = ('X', 'Y', 'Z', '-X', '-Y', '-Z')&lt;br /&gt;
&lt;br /&gt;
for a in opts:&lt;br /&gt;
    for b in opts:&lt;br /&gt;
        if a[-1] != b[-1]:&lt;br /&gt;
            mat = world_transform(a,  b)&lt;br /&gt;
            exp = tuple([tuple([j for j in k]) for k in mat])&lt;br /&gt;
            print(&amp;quot;%s: %s,&amp;quot; % ((a, b), exp))&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>wiki&gt;Ideasman42</name></author>
		
	</entry>
</feed>