#### This script file creates a truncated cone using the planar solid object #### ################### Copyright 2015 Lumerical Solutions, Inc. ################## # Inputs # radius_bottom = bottom radius in um # radius_top = top radius in um # x = center of structure in x axis in um # y = center of structure in y axis in um # z = center of structure in z axis in um # zspan = height of cone in um # segment = Number of linear segments to create the base circle # material = material type # name = structure name # Intitialization radius_bottom = 3; radius_top = 1.5; x = 0; y = 0; z = 0; zspan = 10; segment = 20; material = "Si (Silicon)"; name = "silicon"; # Code start ## Create array for vetices theta_temp = linspace(0,2*pi,segment+1); theta = theta_temp(1:segment); # Bottom circle (vertices starting from 1) x1 = x*1e-6 + radius_bottom*1e-6*cos(theta); y1 = y*1e-6 + radius_bottom*1e-6*sin(theta); z1 = matrix(segment,1) + z*1e-6 - zspan*1e-6/2; # Top circle (vertices starting from segment+1) x2 = x*1e-6 + radius_top*1e-6*cos(theta); y2 = y*1e-6 + radius_top*1e-6*sin(theta); z2 = matrix(segment,1) + z*1e-6 + zspan*1e-6/2; # Base center (vertex number 2*segment+1) x3 = x*1e-6; y3 = y*1e-6; z3 = z*1e-6 - zspan*1e-6/2; # cone top (vertex number 2*segment+2) x4 = x*1e-6; y4 = y*1e-6; z4 = z*1e-6 + zspan*1e-6/2; x = [x1;x2;x3;x4]; y = [y1;y2;y3;y4]; z = [z1;z2;z3;z4]; vtx = [x,y,z]; # Vertices array ## Creating cell for facets a = cell(3*segment); for(i=1:3*segment) { a{i} = cell(1); } # Base for(i=1:segment-1) { a{i}{1} = [i+1,i,2*segment+1]; } a{segment}{1} = [1,segment,2*segment+1]; # Top for(i=1:segment-1) { a{segment+i}{1} = [segment+i,segment+i+1,2*segment+2]; } a{2*segment}{1} = [2*segment,segment+1,2*segment+2]; # Surface for(i=1:segment-1) { a{2*segment+i}{1} = [i,i+1,segment+i+1,segment+i]; } a{3*segment}{1} = [segment,1,segment+1,2*segment]; ## Create planar solid addplanarsolid(vtx,a); set("material",material); set("name",name);