Skip to content

Commit

Permalink
Add dx and dy functions to Sketch
Browse files Browse the repository at this point in the history
  • Loading branch information
bschwind committed Sep 14, 2024
1 parent c7960aa commit e4ccbf4
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions crates/opencascade/src/workplane.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,39 @@ impl Sketch {
self
}

pub fn line_dx(mut self, dx: f64) -> Self {
let cursor = self.workplane.to_local_pos(self.cursor);
let new_point = self.workplane.to_world_pos(dvec3(cursor.x + dx, cursor.y, 0.0));
let new_edge = Edge::segment(self.cursor, new_point);
self.cursor = new_point;

self.add_edge(new_edge);

self
}

pub fn line_dy(mut self, dy: f64) -> Self {
let cursor = self.workplane.to_local_pos(self.cursor);
let new_point = self.workplane.to_world_pos(dvec3(cursor.x, cursor.y + dy, 0.0));
let new_edge = Edge::segment(self.cursor, new_point);
self.cursor = new_point;

self.add_edge(new_edge);

self
}

pub fn line_dx_dy(mut self, dx: f64, dy: f64) -> Self {
let cursor = self.workplane.to_local_pos(self.cursor);
let new_point = self.workplane.to_world_pos(dvec3(cursor.x + dx, cursor.y + dy, 0.0));
let new_edge = Edge::segment(self.cursor, new_point);
self.cursor = new_point;

self.add_edge(new_edge);

self
}

pub fn arc(mut self, (x1, y1): (f64, f64), (x2, y2): (f64, f64), (x3, y3): (f64, f64)) -> Self {
let p1 = self.workplane.to_world_pos(dvec3(x1, y1, 0.0));
let p2 = self.workplane.to_world_pos(dvec3(x2, y2, 0.0));
Expand Down

0 comments on commit e4ccbf4

Please sign in to comment.