Skip to content

Shearing or other multmatrix equivalent #1139

Answered by hrgdavor
abejfehr asked this question in Q&A
Discussion options

You must be logged in to vote

Quickly thinking about it, it should be possible.
https://openjscad.xyz/docs/module-modeling_transforms.html#.transform

transforms allows you to supply your own transform matrix and shear should work fine.

notable difference is that in openscad it is two dimensional 4x4 array, and in jscad a simple 16 length array

const jscad = require('@jscad/modeling')
const {transform, translate} = jscad.transforms
const {cube} = jscad.primitives


const main = ()=>{
  const skew = 0.1
  const matrix = [
        1,skew,0,-skew,
        0,1,0,0,
        0,0,1,0,
        0,0,0,1 
        ]
  return [
     transform(matrix,cube({size:10})),
     translate([-20,0,0],cube({size:10})),
     ]
}

module.exports 

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@abejfehr
Comment options

Answer selected by abejfehr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants