-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rod.m
34 lines (26 loc) · 809 Bytes
/
Rod.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
classdef Rod < Shape
properties
Length
end
methods
function obj = Rod(l, varargin)
obj@Shape(varargin{:});
obj.Length = l;
obj.Vertices = [-l l;
0 0]/2;
obj.Hooks = {'l', 'r'};
end
function J = inertia(obj)
J = obj.Mass * (obj.Length^2) / 12;
end
function params = collisionParams(obj)
params = [obj.Length 0 1];
end
function ppib = plotPointsInBase(obj, parent_tf)
verts = obj.Vertices;
perp = [0 1]' * obj.Length /200;
points = [verts - perp, fliplr(verts + perp)];
ppib = obj.pointsInBase(points, parent_tf);
end
end
end