changeset 332:875386d0b2ff feature/beams

Fixed a bug in draw and added a helper function to parametrization.Ti.
author Jonatan Werpers <jonatan@werpers.com>
date Mon, 03 Oct 2016 11:44:05 +0200
parents ba0fee896b41
children 0fd4b259af9e
files +draw/prompt_bezier.m +parametrization/Ti.m
diffstat 2 files changed, 19 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/+draw/prompt_bezier.m	Thu Sep 29 13:04:16 2016 +0200
+++ b/+draw/prompt_bezier.m	Mon Oct 03 11:44:05 2016 +0200
@@ -22,8 +22,8 @@
     p.Color = Color.yellow;
     p.MarkerSize = 16;
 
-    C = grid.Curve.bezier(a,c1,c2,b);
-    fprintf('C = grid.Curve.bezier([%.3g; %.3g],[%.3g; %.3g],[%.3g; %.3g],[%.3g; %.3g]);\n',a,c1,c2,b)
+    C = parametrization.Curve.bezier(a,c1,c2,b);
+    fprintf('C = parametrization.Curve.bezier([%.3g; %.3g],[%.3g; %.3g],[%.3g; %.3g],[%.3g; %.3g]);\n',a,c1,c2,b)
     h = C.plot();
     uistack(h,'bottom');
 
--- a/+parametrization/Ti.m	Thu Sep 29 13:04:16 2016 +0200
+++ b/+parametrization/Ti.m	Mon Oct 03 11:44:05 2016 +0200
@@ -182,6 +182,23 @@
             obj = parametrization.Ti(g1,g2,g3,g4);
         end
 
+        % Like the constructor but allows inputing line curves as 2-cell arrays:
+        %     example: parametrization.Ti.linesAndCurves(g1, g2, {a, b} g4)
+        function obj = linesAndCurves(C1, C2, C3, C4)
+            C = {C1, C2, C3, C4};
+            c = cell(1,4);
+
+            for i = 1:4
+                if ~iscell(C{i})
+                    c{i} = C{i};
+                else
+                    c{i} = parametrization.Curve.line(C{i}{:});
+                end
+            end
+
+            obj = parametrization.Ti(c{:});
+        end
+
         function label(varargin)
             if nargin == 2 && ischar(varargin{2})
                 label_impl(varargin{:});