Skip to content

Commit

Permalink
πŸ›(transform): adjust transformation matrix for LCD coordinates
Browse files Browse the repository at this point in the history
Modify the transformation matrix to invert the y-axis when using LCD coordinates, ensuring correct visualization orientation. Update the plotting code to use the adjusted transformation matrix
  • Loading branch information
W-Mai committed Nov 12, 2024
1 parent ab289c0 commit ec290db
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/common_vec_op/visualizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ impl IVisualizer for CommonVecVisualizer {
colorful_block: bool,
lcd_coords: bool,
) {
let mut trans_matrix = self.t;
if lcd_coords {
trans_matrix[1][1] = trans_matrix[1][1].neg();
}
let plot = Plot::new("plot")
.data_aspect(1.0)
.y_axis_formatter(move |mk, _range| {
Expand All @@ -42,7 +46,7 @@ impl IVisualizer for CommonVecVisualizer {
}
let points = points
.into_iter()
.map(|v| v.matrix(self.t).cast())
.map(|v| v.matrix(trans_matrix).cast())
.collect::<Vec<VecLineData>>();
let curr_line_start = *points.first().unwrap();
if !last_line_end.is_same(&curr_line_start as &dyn IVisData) && show_inter_dash {
Expand Down

0 comments on commit ec290db

Please sign in to comment.