function [x, y, z] = transmission( p, frontr, coneh, rearr, rearl ) % constuct the mesh for a transmission % % transmission( p, frontr, coneh, rearr, rearl, ang) % % p is the position of the center of the face % frontr the radius of the front % coneh the length of the cone % rearr the radius of the cylinder % rrearl the length of the rear axial = 20; global rotational radial = 20; % front face of the cone ll = linspace(0, rearl, axial); thl = linspace(0, 2*pi, rotational); rl = linspace(0, frontr, radial); [r, th] = meshgrid( rl, thl ); x1 = p(1) * ones(size(r)); y1 = p(2) + r.*cos(th); z1 = p(3) + r.*sin(th); % body of the cylinder [l, th] = meshgrid(ll, thl); x2 = p(1) + coneh + l; [by, bz] = body( rearr, th); y2 = p(2) + by; z2 = p(3) + bz; % back face of the axle rl = linspace(rearr, 0, radial); [r, th] = meshgrid( rl, thl ); x3 = (p(1) + coneh + rearl) * ones(size(r)); y3 = p(2) + r.*cos(th); z3 = p(3) + r.*sin(th); x = [x1 x2 x3]; y = [y1 y2 y3]; z = [z1 z2 z3]; function [y, z] = body( r, th ) y = r * cos(th); z = r * sin(th);