dev #90

Merged
ksenia_mikhailova merged 20 commits from dev into main 2025-03-20 14:15:19 +03:00
3 changed files with 20 additions and 6 deletions
Showing only changes of commit c471e49418 - Show all commits

View File

@ -129,7 +129,6 @@ const setBraceCount = () => {
setBraceCount() setBraceCount()
watch(lamelles_count, setBraceCount) watch(lamelles_count, setBraceCount)
const calculateAddScale = (model: Mesh, k = 1): number => { const calculateAddScale = (model: Mesh, k = 1): number => {
if (!model.geometry.boundingBox) { if (!model.geometry.boundingBox) {
model.geometry.computeBoundingBox(); // Вычисляем boundingBox, если он не был вычислен ранее model.geometry.computeBoundingBox(); // Вычисляем boundingBox, если он не был вычислен ранее
@ -146,6 +145,19 @@ const calculateAddScale = (model: Mesh, k = 1): number => {
return (lamelle_height.value * k) / boundingBoxHeight; return (lamelle_height.value * k) / boundingBoxHeight;
}; };
const calculateFasteningScale = (model_fastening: Mesh, model_lamelle: Mesh, c = 'z'): number => {
function getWidth(model: Mesh, c) {
if (!model.geometry.boundingBox) {
model.geometry.computeBoundingBox(); // Вычисляем boundingBox, если он не был вычислен ранее
}
return Math.abs(
model.geometry.boundingBox!.max[c] - model.geometry.boundingBox!.min[c]
);
}
return getWidth(model_lamelle, c) / (getWidth(model_fastening, c))
};
const pillar = ref<Mesh[]>([]) const pillar = ref<Mesh[]>([])
const setPillar = () => { const setPillar = () => {
@ -159,8 +171,6 @@ const setPillar = () => {
pillar_inner.scale.setComponent(1, lamelles_count.value * calculateAddScale(pillar_inner)); pillar_inner.scale.setComponent(1, lamelles_count.value * calculateAddScale(pillar_inner));
const bottom = props.models.pillar_bottom.children[0]; const bottom = props.models.pillar_bottom.children[0];
const bottomHeight = Math.abs(bottom.geometry.boundingBox.max.y - bottom.geometry.boundingBox.min.y)
bottom.position.setComponent(1, bottomHeight * -1);
let arr = [top, pillar_outer, pillar_inner, bottom] let arr = [top, pillar_outer, pillar_inner, bottom]
arr.map(el => { arr.map(el => {
@ -169,7 +179,7 @@ const setPillar = () => {
set_material( set_material(
{ children: [arr[2]] }, { children: [arr[2]] },
getColorHexFromRal(pillar_color.value), getColorHexFromRal(pillar_color.value),
{ pattern: pillar_pattern.value, count: lamelles_count.value }, { pattern: pillar_pattern.value, count: lamelles_count.value * calculateAddScale(pillar_inner) },
true true
) )
pillar.value = arr.map(el => el.clone()) pillar.value = arr.map(el => el.clone())
@ -201,16 +211,20 @@ const setFastening = () => {
0 0
); );
top.scale.setComponent(0, v); top.scale.setComponent(0, v);
top.scale.setComponent(2, calculateFasteningScale(top, props.models.lamelle.children[0]));
let c = 0.002 * scale_koef
const side_one = props.models.fastening_side.clone().children[0]; const side_one = props.models.fastening_side.clone().children[0];
side_one.name = 'side_one' side_one.name = 'side_one'
side_one.position.set(pillar_one_pos.value, 0, 0.002 * scale_koef); side_one.position.set(pillar_one_pos.value, 0, c);
side_one.scale.set(1, lamelles_count.value * calculateAddScale(side_one), 1) side_one.scale.set(1, lamelles_count.value * calculateAddScale(side_one), 1)
side_one.scale.setComponent(2, calculateFasteningScale(side_one, props.models.lamelle.children[0]));
const side_two = props.models.fastening_side.clone().children[0]; const side_two = props.models.fastening_side.clone().children[0];
side_two.name = 'side_two' side_two.name = 'side_two'
side_two.scale.set(-1, lamelles_count.value * calculateAddScale(side_two), -1) side_two.scale.set(-1, lamelles_count.value * calculateAddScale(side_two), -1)
side_two.position.set(pillar_two_pos.value, 0, -0.005 * scale_koef); side_two.position.set(pillar_two_pos.value, 0, c);
side_two.scale.setComponent(2, calculateFasteningScale(side_two, props.models.lamelle.children[0]));
let arr = [top_one, top_two, top, side_one, side_two]; let arr = [top_one, top_two, top, side_one, side_two];
[top, side_one, side_two, ...braces.value].map(el => { [top, side_one, side_two, ...braces.value].map(el => {

BIN
public/models_exp.zip Normal file

Binary file not shown.

Binary file not shown.