Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix crossects dimensions #199

Merged
merged 5 commits into from
Mar 26, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions model_obj/crosssects/breadloaf/CrossSectBreadloaf.m
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@
%calculate coordinates each point starting in bottom right
%corner and moving counterclockwise around the breadloaf

p1 = [ w/2, 0 ];
p1 = [ w/2, feval(class(w), 0)];
p2 = [ w/2 - l*cos(alpha), l*sin(alpha) ];
p3 = [-w/2 + l*cos(alpha), l*sin(alpha) ];
p4 = [-w/2, 0 ];
p4 = [-w/2, feval(class(w), 0)];

beta = asin(p2(1)/r);
base = r*cos(beta);
arcCenter = [0, -(base - p2(2))];
arcCenter = [feval(class(w), 0), -(base - p2(2))];

%transform coords
p1 = obj.location.transformCoords(p1);
Expand All @@ -53,7 +53,7 @@
[leftSeg] = drawer.drawLine(p3, p4);
[baseSeg] = drawer.drawLine(p4, p1);

innerCoord = obj.location.transformCoords( [0, l*sin(alpha)/2] );
innerCoord = obj.location.transformCoords([feval(class(w), 0), l*sin(alpha)/2] );

segments = [rightSeg, arc, leftSeg, baseSeg];
csToken = CrossSectToken(innerCoord, segments);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
r = obj.dim_r_o;
t = obj.dim_t;

x_out = 0;
x_in = 0;
x_out = feval(class(t), 0);
x_in = feval(class(t), 0);
x = [x_out, x_out, x_in, x_in];

y_out = r;
Expand Down
4 changes: 2 additions & 2 deletions model_obj/crosssects/hollowRectangle/CrossSectHollowRect.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@

function [csToken] = draw(obj, drawer)
validateattributes(drawer, {'DrawerBase'}, {'nonempty'});
axis = DimMillimeter([0,0]);
w=obj.dim_w;
h=obj.dim_h;
t1=obj.dim_t1;
t2=obj.dim_t2;
t3=obj.dim_t3;
t4=obj.dim_t4;
t4=obj.dim_t4;
axis = DimMillimeter([feval(class(w), 0),feval(class(w), 0)]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we be using DimMillimeter explicitly here instead of just feval ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Bharat-Ramadas I think feval makes more sense than DimMillimeter.....For example, the user may not always be specifying the dimension as DimMillimeter and may choose DimInch / DimMeter / any other ?

Copy link
Contributor

@Bharat-Ramadas Bharat-Ramadas Mar 24, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the lack of clarity, what I meant is why can't axis = DimMillimeter([feval(class(w), 0),feval(class(w), 0)]) be just axis = [feval(class(w), 0),feval(class(w), 0)]

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Bharat-Ramadas Gotcha! I have fixed this...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better yet, do this: axis = feval(class(w), [0 0])

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, just made the update.


% Create inner and outer points
points_i=[axis(1)+t3,axis(2)+t4; axis(1)+t3,axis(2)+h-t2;...
Expand Down