def barycentric_coordinate( check_point )
      Util3D.check_arg_type(::Vector3, check_point)

      v0 = @vertices[0]
      v1 = @vertices[1]
      v2 = @vertices[2]

      d1 = v1 - v0
      d2 = v2 - v1
      n = d1.cross(d2);
      if((n.x).abs >= (n.y).abs && (n.x).abs >= (n.z).abs)
        uu1 = v0.y - v2.y;
        uu2 = v1.y - v2.y;
        uu3 = check_point.y  - v0.y;
        uu4 = check_point.y  - v2.y;
        vv1 = v0.z - v2.z;
        vv2 = v1.z - v2.z;
        vv3 = check_point.z  - v0.z;
        vv4 = check_point.z  - v2.z;
      elsif((n.y).abs >= (n.z).abs)
        uu1 = v0.z - v2.z;
        uu2 = v1.z - v2.z;
        uu3 = check_point.z  - v0.z;
        uu4 = check_point.z  - v2.z;
        vv1 = v0.x - v2.x;
        vv2 = v1.x - v2.x;
        vv3 = check_point.x  - v0.x;
        vv4 = check_point.x  - v2.x;
      else
        uu1 = v0.x - v2.x;
        uu2 = v1.x - v2.x;
        uu3 = check_point.x  - v0.x;
        uu4 = check_point.x  - v2.x;
        vv1 = v0.y - v2.y;
        vv2 = v1.y - v2.y;
        vv3 = check_point.y  - v0.y;
        vv4 = check_point.y  - v2.y;
      end

      denom = vv1 * uu2 - vv2* uu1
      if(denom == 0.0)
	return nil
      end
      b = Array.new(3)
      oneOverDenom = 1.0 / denom ;
      b[0] = (vv4*uu2 - vv2*uu4) * oneOverDenom;
      b[1] = (vv1*uu3 - vv3*uu1) * oneOverDenom;
      b[2] = 1.0 - b[0] - b[1];
      return b;
    end
def barycentric_coordinate( check_point )
      Util3D.check_arg_type(::Vector3, check_point)

      v0 = @vertices[0]
      v1 = @vertices[1]
      v2 = @vertices[2]

      d1 = v1 - v0
      d2 = v2 - v1
      n = d1.cross(d2);
      if((n.x).abs >= (n.y).abs && (n.x).abs >= (n.z).abs)
        uu1 = v0.y - v2.y;
        uu2 = v1.y - v2.y;
        uu3 = check_point.y  - v0.y;
        uu4 = check_point.y  - v2.y;
        vv1 = v0.z - v2.z;
        vv2 = v1.z - v2.z;
        vv3 = check_point.z  - v0.z;
        vv4 = check_point.z  - v2.z;
      elsif((n.y).abs >= (n.z).abs)
        uu1 = v0.z - v2.z;
        uu2 = v1.z - v2.z;
        uu3 = check_point.z  - v0.z;
        uu4 = check_point.z  - v2.z;
        vv1 = v0.x - v2.x;
        vv2 = v1.x - v2.x;
        vv3 = check_point.x  - v0.x;
        vv4 = check_point.x  - v2.x;
      else
        uu1 = v0.x - v2.x;
        uu2 = v1.x - v2.x;
        uu3 = check_point.x  - v0.x;
        uu4 = check_point.x  - v2.x;
        vv1 = v0.y - v2.y;
        vv2 = v1.y - v2.y;
        vv3 = check_point.y  - v0.y;
        vv4 = check_point.y  - v2.y;
      end

      denom = vv1 * uu2 - vv2* uu1
      if(denom == 0.0)
	return nil
      end
      b = Array.new(3)
      oneOverDenom = 1.0 / denom ;
      b[0] = (vv4*uu2 - vv2*uu4) * oneOverDenom;
      b[1] = (vv1*uu3 - vv3*uu1) * oneOverDenom;
      b[2] = 1.0 - b[0] - b[1];
      return b;
    end
[Input]
  _check_point_ should be Vector3.
 [Output]
  return barycentric_coordinate on check_point as three element Array of Numeric.