flypath3d

 

| free Matlab® package for 3d visualization of
| missile and air target trajectories

Contents

| package description | user manual | examples of application | add-ones |
| program availability and system requirements | download section |

Package description

The flypath3d package a free Matlab software for 3D visualizations of missile and air target trajectories that provide a visual reference for the computer simulation. Because of its versatility and ease of use, the software can help to produce attractive presentations for various scientific or public outreach purposes.

The flypath3d package is generally presented in:

Bu¿antowicz W. "Matlab Script for 3D Visualization of Missile and Air Target Trajectories".
International Journal of Computer and Information Technology 5 (2016)5, pp. 419-422.

The described package is freely available for scientific and educational use. You can also modify and/or distribute this software for any purpose. However, when using the package, please remember to cite the paper.

The software is provided "as is" and the author disclaims all warranties with regard to this software including all implied warranties of merchantability and fitness. In no event shall the author be liable for any special, direct, indirect, or consequential damages or any damages whatsoever resulting from loss of use, data or profits, whether in an action of contract, negligence or other tortious action, arising out of or in connection with the use or performance of this software.

| back to the top |

User manual

Installation of the package

The package is composed of several M-code files that are installed in the Matlab® environment using the 'package_setup' command. It provides functions for constructing complex 3D scenes by placing consecutive objects that act, in effect, like building blocks within the layout.

Download the flypath3d package and unzip it to the destination directory. Next execute configuration script:

package_setup

That's all! Your copy of flypath3d package is ready to work.

Program description and data set organization

Objects can be created using the 'new_object' function; the package allows kinematic data, 3D model geometry definitions, and display parameters to be combined into a single easy-to-use data set:

new_object(filename,matrix,varargin);

The function parameters are: output set file name ('filename'), array of kinematic data ('matrix') and some optional arguments ('varargin'). The array of kinematic data K contains three Cartesian coordinate vectors x, y, z and three angle vectors θ, ψ, φ completely describing the 3D object position in time:

where xi, yi, zi are the object gravity centre Cartesian coordinates and θi, ψi, φi are the pitch, yaw and roll angles in successive instants of time, i∈{1, 2, …, j}.

The transformation matrix M is taken as follows:

where θ, ψ and φ are the current values of pitch, yaw and roll angle, respectively.

The relationship of these angles to the orientation of the visualized object in space is illustrated on the picture below. A positive value of the pitch angle shows the object’s climb, a positive value of the yaw angle shows the object’s deviation to the right, and a positive value of the roll angle shows the tilting of the object to the right relative to its longitudinal axis. All of the position and angle values refer to the global inertial clockwise coordinate system with a north-oriented y axis. This means that an object with initial coordinates x0 = 0, y0 = 0, z0 = 0, angle values θ = 0, ψ = 0, φ = 0, and constant speed v = const will move along the y axis in the positive direction.

| interpretation of pitch, yaw and roll angle signs |

Finally, the 'flypath' function is executed to generate the scene and save the result in png or gif file format:

flypath(object_1,object_2,...,object_n,varargin);

Detailed instructions for use of the software are provided further in this document.

Table of functions

package_setup | package_setup.m

The flypath3d package check & configuration file

Syntax:

package_setup

Parameters:

(none)

 

Opt. arguments:

(none)

 

Example of use:

package_setup

| back to the top |


new_object | new_object.m

Creates 3d object data set for visualization

Syntax:

new_object(filename,matrix,varargin)

Parameters:

filename

output set file name (*.mat)

 

matrix

array of kinematic vectors data,
matrix(:,1) - x Cartesian coordinate vector [m],
matrix(:,2) - y Cartesian coordinate vector [m],
matrix(:,3) - z Cartesian coordinate vector [m],
matrix(:,4) - pitch angle vector [rad],
matrix(:,5) - yaw angle vector [rad],
matrix(:,6) - roll angle vector [rad]

Opt. arguments:

alpha

alpha channel value (0-1 - default 1),

 

edge

model edge color ([R G B] - default [.4 .4 .4]),

 

face

model face color ([R G B] - default [.5 .5 .5]),

 

model

3d model file name (string - default 'missile.mat'),

 

path

trajectory line visibility ('on','off' - default 'on'),

 

pathcolor

trajectory line color ([R G B] - default [.3 .3 .3]),

 

pathwidth

trajectory line width (default 1),

 

scale

model scale (default 1)

Example of use:

trajectory = load('trajectory_tbm.mat');
new_object('tbm.mat',trajectory,...
'model','scud.mat','scale',5,...
'path','on','pathcolor',[.89 .0 .27]);

| back to the top |


flypath | flypath.m

Displays static and animated trajectories of missiles and air targets

Syntax:

flypath(object_1,object_2,...,object_n,varargin)

Parameters:

object_x

object data set produced by 'new_object' function,
see 'new_object' function description
to get more information

Opt. arguments:

animate

animation on/off ('on','off' - default 'off'),

 

axis

axes visibility ('on','off' - default 'on'),

 

axiscolor

axes and axes font color ([R G B] - default [0 0 0]),

 

color

display area color ([R G B] - default [1 1 1]),

 

dpi

dpi value (75, 150, 300, 600 - default 150),

 

font

font name (string - default 'Times New Roman'),

 

fontsize

font size (default 12),

 

output

output file name (string - default 'none'),

 

step

model repetition density (default 10),

 

view

camera view angles ([azimuth elevation] - default [15 30]),

 

window

display area size ([width height] - default [800 600]),

 

xlim

x axes limits ([min max] or 'off' - default 'off'),

 

ylim

y axes limits ([min max] or 'off' - default 'off'),

 

zlim

z axes limits ([min max] or 'off' - default 'off'),

Example of use:

trajectory = load('trajectory_tbm.mat');
new_object('tbm.mat',trajectory,...
'model','scud.mat','scale',5,...
'path','on','pathcolor',[.89 .0 .27]);
flypath('tbm.mat',...
'animate','off','step',30,...
'axis','on','axiscolor',[0 0 0],'color',[1 1 1],...
'font','Georgia','fontsize',6,...
'view',[0 0],'window',[1800 600],...
'xlim',[-2e4 16e4],'ylim',[-10 10],'zlim',[0 4e4],...
'output','tbm_example.png','dpi',600);

| back to the top |


model_import | model_import.m

Converts *.obj mesh file to the vertex and face list *.mat file

Syntax:

model_import(filename,varargin)

Parameters:

filename

3d model file name (*.obj)

Opt. arguments:

output

output file name (string - default filename)

Example of use:

model_import('model.obj');
model_import('model.obj','output','new_model.mat');

| back to the top |


model_show | model_show.m

Displays static and animated 3d models

Syntax:

model_show(filename,varargin)

Parameters:

filename

3d model file name (*.mat)

Opt. arguments:

alpha

alpha channel value (0.0-1.0 - default 1.0),

 

animate

animation on/off ('on','off' - default 'off'),

 

color

display area color ([R G B] - default [1 1 1]),

 

dpi

dpi value (75, 150, 300, 600 - default 150),

 

edge

model edge color ([R G B] - default [.4 .4 .4]),

 

face

model face color ([R G B] - default [.5 .5 .5]),

 

output

output file name (string - default 'none'),

 

view

camera view angles ([azimuth elevation] - default [15 30]),

 

window

display area size ([width height] - default [800 600])

Example of use:

model_show('model.mat');
model_show('model.mat','output','model.png','dpi',600);
model_show('model.mat','animate','on','output','model.gif');

| back to the top |

Examples of application

The script described here can be applied in many fields. Several examples of possible package applications are presented below. The software can generate both static images and animations for several purposes, including among others: missile and/or air target flight trajectories (see section A and B), missile-target engagement visualizations (section D) and tactical scenes generation support (section E). Static images can be saved as png files with user-defined resolution. Animations can be made by including optional arguments for 'flypath' function. Animations are saved to the current Matlab® folder as animated gif images.

A. Ballistic missile flight trajectory

Copy code listed below and paste it into your Matlab® command window:

% load ballistic missile trajectory from file
load('trajectory_tbm.mat');
 
% create an object
new_object('ballistic_missile.mat',data,...
'model','scud.mat','scale',800,...
'edge',[0 0 0],'face',[0 0 0],'alpha',1,...
'path','on','pathcolor',[.89 .0 .27],'pathwidth',1);
 
% ballistic missile trajectory visualization
flypath('ballistic_missile.mat',...
'animate','off','step',30,...
'axis','on','axiscolor',[0 0 0],'color',[1 1 1],...
'font','Georgia','fontsize',6,...
'view',[0 0],'window',[1800 600],...
'xlim',[-2e4 16e4],'ylim',[-10 10],'zlim',[0 4e4],...
'output','tbm_example.png','dpi',600);

| ballistic missile trajectory |

An example code for animated version:

% animation of ballistic missile trajectory
flypath('ballistic_missile.mat',...
'animate','on','step',1,...
'axis','on','axiscolor',[0 0 0],'color',[1 1 1],...
'font','Georgia','fontsize',12,...
'view',[0 0],'window',[1800 600],...
'xlim',[-2e4 16e4],'ylim',[-10 10],'zlim',[0 4e4]);

B. Air target trajectory

Copy code listed below and paste it into your Matlab® command window:

% load aircraft trajectory from file
load('trajectory_aircraft.mat');
 
% create an object
new_object('aircraft.mat',data,...
'model','f-16.mat','scale',100,...
'edge',[0 0 0],'face',[0 0 0],'alpha',1,...
'path','on','pathcolor',[.89 .0 .27],'pathwidth',1);
 
% aircraft trajectory visualization
flypath('aircraft.mat',...
'animate','off','step',150,...
'axis','on','axiscolor',[0 0 0],'color',[1 1 1],...
'font','Georgia','fontsize',6,...
'view',[0 90],'window',[1800 900],...
'xlim',[-15e3 10e3],'ylim',[-5e3 25e3],'zlim',[-15e3 15e3],...
'output','aircraft_example.png','dpi',600);

| aircraft trajectory |

Use the standard Matlab® command set to display your trajectory anyhow you want, e.g.:

view([45 25]);
grid off;

| aircraft trajectory |

Animated version:

% load aircraft trajectory from file
load('trajectory_circle.mat');
 
% create an object
new_object('aircraft.mat',data,...
'model','f-16.mat','scale',150,...
'edge',[0 0 0],'face',[0 0 0],'alpha',1,...
'path','on','pathcolor',[.89 .0 .27],'pathwidth',1);
 
% aircraft trajectory animation
flypath('aircraft.mat',...
'animate','on','step',5,...
'axis','on','axiscolor',[0 0 0],'color',[1 1 1],...
'font','Georgia','fontsize',10,...
'view',[45 30],'window',[800 420],...
'xlim',[-10e3 10e3],'ylim',[-10e3 10e3],'zlim',[0 2e3],...
'output','test.gif');

| animation of aircraft trajectory |

Aileron roll example code:

% prepare environment and generate aircraft trajectory
clear all;
close all;
clc;
data = zeros(400,6);
 
% x, y and z coordinates
data(:,1) = 0;
data(:,2) = .5:.5:200;
data(:,3) = 500;
 
% pitch, yaw and roll angle values
data(:,4) = 0;
data(:,5) = 0;
data(21:380,6) = (1:1:360)/57.3;
 
% prepare aircraft simulation model
new_object('aircraft.mat',data,...
'model','f-16.mat','edge',[.1 .1 .1],'face',[.1 .1 .1],...
'path','on','pathcolor',[.89 .0 .27],'pathwidth',1,'scale',1);
 
% generate the scene and save the result as gif file
flypath('aircraft.mat',...
'animate','on','step',3,...
'font','Georgia','fontsize',10,...
'view',[35 45],'window',[700 700],...
'output','aileron_roll.gif',...
'xlim',[-20 20],'ylim',[0 200],'zlim',[480 520]);

| animation of aileron roll |

C. Visualization of missile airframe stability

You can also use the flypath3d package to visualize missile model data collected e.g. during wind tunnel tests. Copy code listed below and paste it into your Matlab® command window to run the example of missile airframe stability problem:

% load stabilized missile airframe data (with autopilot)
load('airframe_stabilized.mat');
new_object('missile_ap.mat',data,...
'model','missile.mat','scale',1,...
'edge','none','face',[0 0 0],'alpha',.6,...
'path','off');
 
% load non-stabilized missile airframe data (without autopilot)
load('airframe_nonstabilized.mat');
new_object('missile_nonap.mat',data,...
'model','missile.mat','scale',1,...
'edge','none','face',[.89 .0 .27],'alpha',.6,...
'path','off');
 
% generate the scene
flypath('missile_ap.mat','missile_nonap.mat',...
'xlim',[-1.5 1.5],'ylim',[-2.0 2.0],'zlim',[-1.5 1.5],...
'font','Georgia','fontsize',12,...
'view',[0 90],'animate','on','step',200);

| visualization of missile airframe stability |

D. Target-missile engagement visualization

Copy code listed below and paste it into your Matlab® command window:

% prepare environment
clear all;
close all;
clc;
 
% insert enemy aircraft
load('trajectory_enemy.mat');
new_object('enemy.mat',data,...
'model','f-16.mat','edge',[.2 .2 .2],'face',[.3 .3 .3],...
'path','on','pathcolor',[.3 .3 .3],'pathwidth',1,'scale',10.0);
 
% insert friendly aircraft
load('trajectory_friend.mat');
new_object('friend.mat',data,...
'model','f-16.mat','edge',[.2 .2 .2],'face',[.3 .3 .3],...
'path','on','pathcolor',[.89 .27 .0],'pathwidth',1,'scale',10.0);
 
% insert air-to-air missile
load('trajectory_aam.mat');
new_object('aam.mat',data,...
'model','missile.mat','edge',[.2 .2 .2],'face',[.3 .3 .3],...
'path','on','pathcolor',[.89 .47 .0],'pathwidth',1,'scale',10.0);
 
% generate the scene and save the result as png file
flypath('friend.mat','enemy.mat','aam.mat',...
'animate','off','step',9000,...
'font','Georgia','fontsize',6,...
'view',[-90 90],'window',[1000 280],...
'output','combat_example.png','dpi',600,...
'xlim',[-500 500],'ylim',[-500 3500],'zlim',[500 1500]);

| visualization of target-missile engagement |

Animated version:

% generate the scene and save the result as animated gif file
flypath('friend.mat','enemy.mat','aam.mat',...
'animate','on','step',500,...
'font','Georgia','fontsize',10,...
'view',[-90 90],'window',[1000 280],...
'output','combat_example.gif',...
'xlim',[-500 500],'ylim',[-500 3500],'zlim',[500 1500]);

| animated visualization of target-missile engagement |

Visualization of air-to-air missile launch:

% prepare environment
clear all;
close all;
clc;
 
% insert friendly aircraft
load('trajectory_friend.mat');
new_object('friend.mat',data(1:2000,:),...
'model','f-16.mat','edge',[.2 .2 .2],'face',[.3 .3 .3],...
'path','on','pathcolor',[.89 .27 .0],'pathwidth',1,'scale',1.0);
 
% insert air-to-air missile
load('trajectory_aam.mat');
new_object('aam.mat',data(1:2000,:),...
'model','missile.mat','edge',[.2 .2 .2],'face',[.3 .3 .3],...
'path','on','pathcolor',[.89 .47 .0],'pathwidth',1,'scale',1.0);
 
% generate the scene and save the result as gif animated file
flypath('friend.mat','aam.mat',...
'animate','on','step',20,...
'font','Georgia','fontsize',10,...
'view',[150 25],'window',[800 675],...
'output','missile_launch.gif',...
'xlim',[-20 20],'ylim',[0 200],'zlim',[980 1020]);

| visualization of missile launch |

Visualization of target hit moment:

% prepare environment
clear all;
close all;
clc;
 
% insert enemy aircraft
load('trajectory_enemy.mat');
new_object('enemy.mat',data(32000:35100,:),...
'model','f-16.mat','edge',[.4 .4 .4],'face',[.6 .6 .6],...
'path','on','pathcolor',[.3 .3 .3],'pathwidth',1,'scale',1.0);
 
% insert air-to-air missile
load('trajectory_aam.mat');
new_object('aam.mat',data(32000:35100,:),...
'model','missile.mat','edge',[.2 .2 .2],'face',[.3 .3 .3],...
'path','on','pathcolor',[.89 .47 .0],'pathwidth',1,'scale',1.0);
 
% generate the scene and save the result as png file
flypath('enemy.mat','aam.mat',...
'animate','on','step',20,...
'font','Georgia','fontsize',10,...
'view',[30 20],'window',[570 700],...
'output','hit_to_kill.gif',...
'xlim',[-200 -140],'ylim',[3300 3400],'zlim',[1150 1250]);

| visualization of missile-target engagement |

| visualization of miss distance |

E. Visualization of tactical scene

There is possibility to use flypath3d package for tactical data visualization. The example code listed below shows the way to combine flypath3d functions with standard Matlab® code for advanced 3d data presentation (simply copy code into your Matlab® command window to run).

% prepare environment
clear all;
close all;
clc;
 
% generate terrain using build-in peaks() function
[x,y] = meshgrid(0:10:500,0:10:500);
z = peaks(51);
for i = 1:1:51
for j = 1:1:51
if z(i,j) < 0
z(i,j) = 0;
else
z(i,j) = 10*z(i,j);
end;
end;
end;
 
% generate 50 random trees
xt = 0.35*ceil(1000*rand(1,50))+100;
yt = 0.50*ceil(1000*rand(1,50));
for i = 1:1:50
data = zeros(60,6);
data(:,1) = xt(i);
data(:,2) = yt(i);
data(:,3) = z(ceil(yt(i)/10),ceil(xt(i)/10))-2*rand;
data(:,5) = pi*rand;
scale = 1.1+rand+rand;
filename = strcat('tree_',num2str(i),'.mat');
new_object(filename,data,...
'model','tree.mat','edge',[.20 .22 .20],'face',[.40 .42 .40],...
'path','off','scale',scale);
end;
 
% insert missile launcher no. 1 at (50,310,0) position
data = zeros(60,6);
data(:,1) = 50;
data(:,2) = 310;
data(:,3) = 0;
data(:,5) = pi/2;
new_object('launcher_1.mat',data,...
'model','launcher-0.mat','edge',[.1 .1 .1],'face',[.3 .3 .3],...
'path','off','scale',2.0);
 
% insert missile launcher no. 2 at (20,260,0) position
data = zeros(60,6);
data(:,1) = 20;
data(:,2) = 260;
data(:,3) = 0;
data(:,5) = pi/7;
new_object('launcher_2.mat',data,...
'model','launcher-90.mat','edge',[.1 .1 .1],'face',[.3 .3 .3],...
'path','off','scale',2.0);
 
% insert missile launcher no. 3 at (80,290,0) position
data = zeros(60,6);
data(:,1) = 80;
data(:,2) = 290;
data(:,3) = 0;
data(:,5) = -pi/8;
new_object('launcher_3.mat',data,...
'model','launcher-0.mat','edge',[.1 .1 .1],'face',[.3 .3 .3],...
'path','off','scale',2.0);
 
% insert multirole fighter
load('trajectory_strike.mat');
new_object('aircraft.mat',data,...
'model','f-16.mat','edge',[.1 .1 .1],'face',[.1 .1 .1],...
'path','on','pathcolor',[.89 .0 .27],'pathwidth',1,'scale',1.1);
 
% insert unguided bomb
load('trajectory_bomb.mat');
new_object('bomb.mat',data,...
'model','missile.mat','edge',[.1 .1 .1],'face',[.1 .1 .1],...
'path','on','pathcolor',[.89 .47 .0],'pathwidth',1,'scale',2.0);
 
% generate the scene
flypath('bomb.mat','aircraft.mat',...
'launcher_1.mat','launcher_2.mat','launcher_3.mat',...
'tree_1.mat','tree_2.mat','tree_3.mat','tree_4.mat','tree_5.mat',...
'tree_6.mat','tree_7.mat','tree_8.mat','tree_9.mat','tree_10.mat',...
'tree_11.mat','tree_12.mat','tree_13.mat','tree_14.mat','tree_15.mat',...
'tree_16.mat','tree_17.mat','tree_18.mat','tree_19.mat','tree_20.mat',...
'tree_21.mat','tree_22.mat','tree_23.mat','tree_24.mat','tree_25.mat',...
'tree_26.mat','tree_27.mat','tree_28.mat','tree_29.mat','tree_30.mat',...
'tree_31.mat','tree_32.mat','tree_33.mat','tree_34.mat','tree_35.mat',...
'tree_36.mat','tree_37.mat','tree_38.mat','tree_39.mat','tree_40.mat',...
'tree_41.mat','tree_42.mat','tree_43.mat','tree_44.mat','tree_45.mat',...
'tree_46.mat','tree_47.mat','tree_48.mat','tree_49.mat','tree_50.mat',...
'animate','off','output','none','step',5,...
'font','Georgia','fontsize',6,...
'view',[0 0],'xlim',[0 500],'ylim',[0 500],'zlim',[0 200]);
surf(x,y,z,...
'FaceColor',[.8 .8 .8],'EdgeColor',[.7 .7 .7],'FaceAlpha',1,'EdgeAlpha',1);
 
% save the result as png file
filename = 'tactical_scene.png';
eval(sprintf('print -dpng -r600 %s;',filename));

| visualization of tactical scene |

| visualization of tactical scene |

Check another examples of code to learn about the capabilities of the flypath3d package:

% prepare environment
clear all;
close all;
clc;
 
% generate simplified sea surface using build-in peaks() function
sea_surf = peaks(500) + repmat(peaks(250),2,2);
 
% insert kara-class cruiser
% disclaimer:
% the kara-class cruiser model is not included with the flypath3d package,
% but you can download it (for personal use only) from http://tf3dm.com
data = zeros(10000,6);
data(:,1) = 180;
data(:,2) = 290;
data(:,3) = 0;
data(:,4) = pi/48;
data(:,5) = -pi/8;
new_object('ship.mat',data,...
'model','kara_cruiser.mat','edge',[.2 .2 .2],'face',[.3 .3 .3],...
'path','off','scale',1.0);
 
% insert hovering helicopter
data = zeros(10000,6);
data(:,1) = 350;
data(:,2) = 140;
data(:,3) = 450;
data(:,5) = -pi/2;
new_object('helicopter.mat',data,...
'model','mi-24.mat','edge',[.1 .1 .1],'face',[.1 .1 .1],...
'path','on','pathcolor',[.89 .0 .27],'pathwidth',1,'scale',2.0);
 
% insert surface-to-air missile
load('trajectory_sam.mat');
new_object('sam.mat',data,...
'model','missile.mat','edge',[.1 .1 .1],'face',[.1 .1 .1],...
'path','on','pathcolor',[.89 .0 .27],'pathwidth',1,'scale',4.0);
 
% generate the scene
flypath('ship.mat','sam.mat','helicopter.mat',...
'animate','off','output','none','step',1000,...
'font','Georgia','fontsize',6,...
'view',[-45 30],'xlim',[0 500],'ylim',[0 500],'zlim',[0 500]);
[x,y,z] = sphere(20);
surf(317.1+20*x,180.1+20*y,468.9+20*z,...
'EdgeColor','none','FaceColor',[.89 .0 .27],'FaceAlpha',.2);
surf(sea_surf,...
'FaceColor',[.2 .4 .9],'EdgeColor',[.9 .9 .9],'FaceAlpha',1,'EdgeAlpha',.2);
 
% save the result as png file
filename = 'tactical_scene.png';
eval(sprintf('print -dpng -r600 %s;',filename));

| visualization of naval scene |

| visualization of naval scene |

| back to the top |

F. Various examples

Visualization of fireball radius of nuclear airburst:

% prepare environment
clear all;
close all;
clc;
 
% generate simplified sea surface using build-in peaks() function
[x,y] = meshgrid(-400:1:400,-400:1:400);
sea_surf = peaks(800) + repmat(peaks(400),2,2) + repmat(peaks(200),4,4);
sea_surf(:,801) = 0;
sea_surf(801,:) = 0;
sea_surf = 0.7*sea_surf;
 
% insert manhattan island
% disclaimer:
% the manhattan model is not included with the flypath3d package,
% but you can download it (for personal use only) from http://aipos3d.com
data = zeros(100,6);
new_object('city.mat',data,...
'model','manhattan.mat','edge',[.2 .2 .2],'face',[.4 .4 .4],...
'path','on','pathcolor',[.89 .0 .27],'pathwidth',1,'scale',5.0);
 
% insert battleship no. 1
% disclaimer:
% the kara-class cruiser model is not included with the flypath3d package,
% but you can download it (for personal use only) from http://tf3dm.com
data = zeros(100,6);
data(:,1) = 180;
data(:,2) = 320;
data(:,3) = 0;
data(:,4) = pi/32;
data(:,5) = -pi/8;
new_object('ship_1.mat',data,...
'model','kara_cruiser.mat','edge',[.2 .2 .2],'face',[.4 .4 .4],...
'path','off','scale',1.0);
 
% insert battleship no. 2
data = zeros(100,6);
data(:,1) = -100;
data(:,2) = 220;
data(:,3) = 0;
data(:,4) = -pi/16;
data(:,5) = pi/6;
new_object('ship_2.mat',data,...
'model','kara_cruiser.mat','edge',[.2 .2 .2],'face',[.4 .4 .4],...
'path','off','scale',1.0);
 
% insert hovering helicopter no. 1
data = zeros(100,6);
data(:,1) = 100;
data(:,2) = 200;
data(:,3) = 300;
data(:,5) = -pi/2;
new_object('heli_1.mat',data,...
'model','mi-24.mat','edge',[.2 .2 .2],'face',[.4 .4 .4],...
'path','off','scale',2.0);
 
% insert hovering helicopter no. 2
data = zeros(100,6);
data(:,1) = 50;
data(:,2) = 230;
data(:,3) = 250;
data(:,5) = -pi/2;
new_object('heli_2.mat',data,...
'model','mi-24.mat','edge',[.2 .2 .2],'face',[.4 .4 .4],...
'path','off','scale',2.0);
 
% insert launcher no. 1
data = zeros(100,6);
data(:,1) = 209;
data(:,2) = -127;
data(:,3) = 9;
data(:,5) = pi/2;
new_object('launcher_1.mat',data,...
'model','launcher-0.mat','edge',[.2 .2 .2],'face',[.4 .4 .4],...
'path','off','scale',2.0);
 
% insert launcher no. 2
data = zeros(100,6);
data(:,1) = 183;
data(:,2) = -137;
data(:,3) = 9;
data(:,5) = pi/7;
new_object('launcher_2.mat',data,...
'model','launcher-90.mat','edge',[.2 .2 .2],'face',[.4 .4 .4],...
'path','off','scale',2.0);
 
% insert ballistic missile
data = zeros(100,6);
data(:,2) = linspace(-300,-100);
data(:,3) = linspace(800,200);
data(:,4) = -1.249;
new_object('nuke.mat',data,...
'model','scud.mat','edge',[0 0 0],'face',[0 0 0],...
'path','on','pathcolor',[.89 .0 .27],'pathwidth',1,'scale',2.0);
 
% generate the scene
flypath('city.mat','ship_1.mat','ship_2.mat','heli_1.mat','heli_2.mat',...
'launcher_1.mat','launcher_2.mat','nuke.mat',...
'animate','off','output','none','step',99,...
'font','Georgia','fontsize',6,...
'view',[90 0],'xlim',[-400 400],'ylim',[-400 400],'zlim',[0 400]);
 
surf(x,y,sea_surf,...
'FaceColor',[.2 .4 .9],'EdgeColor',[.9 .9 .9],'FaceAlpha',1,'EdgeAlpha',.2);
 
% fireball radius of 0.5 kt nuke blast
[x,y,z] = sphere(100);
surf(50*x,-100+50*y,200+50*z,...
'EdgeColor','none','FaceColor',[.89 .0 .27],'FaceAlpha',.4);
text(0,-80,210,'0.5 kt','FontName','Georgia','FontSize',6);
 
% fireball radius of 10 kt nuke blast
[x,y,z] = sphere(100);
surf(150*x,-100+150*y,200+150*z,...
'EdgeColor','none','FaceColor',[.89 .0 .27],'FaceAlpha',.3);
text(0,10,210,'10 kt','FontName','Georgia','FontSize',6);
 
% fireball radius of 45 kt nuke blast
[x,y,z] = sphere(100);
surf(280*x,-100+280*y,200+280*z,...
'EdgeColor','none','FaceColor',[.89 .0 .27],'FaceAlpha',.2);
text(0,140,210,'45 kt','FontName','Georgia','FontSize',6);
 
% fireball radius of 100 kt nuke blast
[x,y,z] = sphere(100);
surf(380*x,-100+380*y,200+380*z,...
'EdgeColor','none','FaceColor',[.89 .0 .27],'FaceAlpha',.1);
text(0,230,210,'100 kt','FontName','Georgia','FontSize',6);
 
% save the result as png file
filename = 'nuke_blast.png';
eval(sprintf('print -dpng -r600 %s;',filename));

| visualization of fireball radius of nuclear airburst |

| visualization of fireball radius of nuclear airburst |

| back to the top |

Add-ones

3d model library

| 3d model examples |

The library includes actually: multirole fighter model (f-16.mat), attack helicopter model (mi-24.mat), ballistic missile model (scud.mat), anti-aircraft missile model (missile.mat), and two launcher models (launcher-0.mat and launcher-90.mat) collected in 'flypath3d\models' directory. To display selected 3d model, e.g. multirole fighter, use the code as follows:

model_show('f-16.mat');

Reference help for 3d model library functions can be obtained using Matlab® command:

help model_import
help model_show

3d model import & conversion example

The flypath3d package supports 3d models collected in obj format files. Additional models can be obtained from obj format files created by popular 3d graphics and animation software, e.g. Blender or 3ds Max. Please note that the package supports only triangular mesh objects and it is important to make appropriate conversion of prepared model before its use in flypath3d. The 3d model can be imported and tested using the following exemplary code:

% load 3d model from obj file and convert it to mat format
model_import('balloon.obj');
 
% simple model presentation
model_show('balloon.mat');
 
% display model with extra parameter set
model_show('balloon.mat',...
'face',[.89 .0 .27],'edge',[.89 .0 .27],'alpha',.5,...
'window',[800 400],'color',[1 1 1],'view',[15 30],...
'animate','off','output','balloon.png','dpi',600);
 
% animation example
model_show('balloon.mat',...
'animate','on','output','animated_balloon.gif',...
'face',[.89 .0 .27],'edge','none',...
'window',[300 310]);

| simple model presentation |

| 3d model with extra parameter set |

| back to the top |

Program availability and system requirements

The flypath3d package is freely available for scientific and educational use. When using the package, please cite the paper.

The flypath3d package requires only the basic module of MathWorks™ Matlab® and an ordinary PC or notebook to use. All the scripts were tested with Matlab® R2014a under 32/64-bit Microsoft® Windows® 7 and 8.1 operating systems.

Supplementary data associated with given examples can be found in download section.

| back to the top |

Download

flypath3d package (examples included) — zip file (10 528 973 bytes)