对于2D/3D空间的元素坐标计算 (Matlab)

给定3个不共线的点的坐标,指明行数和列数,就可以计算出这个平行四边形内所有元素的坐标。主要利用平行四边形法则和定比分点公式,输出可以是3维数组或者2维数组。

 

function location = position(ini,m,n)



% ------------------------------------

% This program is used to calculate the position of 

% every matrix element in a 3D or 2D plane

% 

%     A      m      B

%      *   *   *   *

%  n   *   *   *   *

%      *   *   *   *

%      *   *   *   *

%     C             D

% 

% Input:

% ini: the initial 3 points of the plane, A B C, row vectors.

%      ini must be a 3*3 or 3*2 matrix, for example:[0,0,0; 0,4,4; 4,0,0];

% m: the column of the matrix, say, m=5;

% n: the row of the matrix, say, n=5;

% 

% Output:

% pos: 3D vectors. Each slice contains the positions of the row points. 

% location: 2D vectors, stored by row.

% ------------------------------------





%% Validation

%Validate the form of ini

form = size(in
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值