film_core/layout.js

50 lines
1.1 KiB
JavaScript
Raw Normal View History

function rotatePoint(centerX, centerY, distance, angleInDegrees) {
const angleInRadians = angleInDegrees * (Math.PI / 180);
const x = centerX + (distance * Math.cos(angleInRadians));
const y = centerY + (distance * Math.sin(angleInRadians));
return { x, y, z : 0 };
}
2025-02-09 17:22:36 +00:00
let plastic = [
'white_plastic',
'green_plastic',
'neonblue_plastic',
'white_plastic',
'green_plastic',
'neonblue_plastic'
]
let obj = [
2025-02-09 17:22:36 +00:00
'16mm_2in',
//'16mm_2in_np',
'16mm_3in',
//'16mm_3in_np',
2025-02-09 17:22:36 +00:00
'8mm_2in',
//'8mm_2in_np',
'8mm_3in',
//'8mm_3in_np',
2025-02-09 17:22:36 +00:00
'35mm_2in',
//'35mm_2in_np',
'35mm_3in'//,
//'35mm_3in_np'
];
let meta = {
objects : []
}
2025-02-09 17:22:36 +00:00
let starting = 15; //(360 / (obj.length * 2));
2025-02-09 17:05:46 +00:00
for (let i = 0; i < obj.length; i++) {
meta.objects.push ({
2025-02-09 17:22:36 +00:00
name : `film_core_${obj[i]}`,
material : plastic[i],
2025-02-09 17:05:46 +00:00
position : rotatePoint(0, 0, 120, starting + (i * (360 / obj.length))),
rotation : {
x : 0,
y : 90,
2025-02-09 17:05:46 +00:00
z : starting + (i * (360 / obj.length))
}
});
}
console.log(JSON.stringify(meta, null, '\t'))