import { MyContext } from "./data/contextapi"; import { useContext, useEffect, useRef } from "react"; import { useTexture } from "@react-three/drei"; import * as THREE from "three"; class CustomCircleCurve extends THREE.Curve { constructor(radius = 1, segments = 64, fragment = 1) { super(); this.radius = radius; this.segments = segments; this.fragment = fragment; } getPoint(t, optionalTarget = new THREE.Vector3()) { const angle = t * Math.PI * this.fragment; const x = Math.cos(angle) * this.radius * 0.5; const y = Math.sin(angle) * this.radius * 0.5; return optionalTarget.set(x, y, 0); } } export default function Structure({ isSide, isRotated, stalenWidth }) { const { door, width, height, frameSize, glassType, frameType, stalenPart, doorConfig, sidePannelConfig, sidePannel, setWidth, sidePannelSize, open, } = useContext(MyContext); const texture = useTexture(frameType); const frameWidth = 0.19; const frameHeight = 0.054 * height; const frameDepth = 0.09; let interframeWidth; let interframeHeight; let interframeWidth2; let interframeHeight2; let interframeWidth3; let interframeHeight3; let interframeDepth = 0.19 / 2; let positioner; let positioner2; let positioner3; let xPosition = []; let yPosition = []; let unitWidth = []; let unitHeight = []; // const doorWidth = (0.06 * width) / stalenPart - sizePannel * 0.06; const doorRef = sidePannelConfig == "eigen maat" ? isSide ? sidePannelSize : width : width; const doorWidth = stalenWidth ? stalenWidth : (sidePannelConfig == "eigen maat" ? isSide ? 0.06 * sidePannelSize : 0.06 * width : 0.06 * width); const doorHeightn = 0.053 * height; const doorDepth = 0.02; if (door == "3panel" || door == "herenhuis") { interframeWidth = doorWidth + frameSize; interframeHeight = frameSize * 0.5; interframeWidth2 = frameSize * 0.5; interframeHeight2 = 0.053 * height; positioner = 4; positioner2 = 10000; } else if ( door == "herman" || door == "4panel" || door == "elody" || door == "3pannel" || door == "drentse" || door == "boerderij" || door == "fabric" || door == "larino" || door == "larino1" || door == "toog" || door == "low-deep" || door == "grandma" || door == "staldeuren" || door == "contempera" || door == "80s" || door == "2panel" || door == "dt3" || door == "dt2" || door == "parallel" || door == "notaris" || door == "toogPlus" || door == "rond" || door == "rondPlus" || door == "porto" || door == "rivera" || door == "dt11" || door == "boender" || door == "dt13" || door == "kasteel" || door == "kathedraal" || door == "gladiator" || door == "the-judge" || door == "prison" || door == "curved" || door == "lindsey" || door == "baku" || door == "supreme" || door == "ultimate" || door == "fisherman" || door == "primier" || door == "elite" ) { interframeWidth = doorWidth + frameSize; interframeHeight = frameSize * 0.5; interframeWidth2 = frameSize * 0.5; interframeHeight2 = 0.053 * height + frameSize; if (door == "dt3") { positioner = 3; } else if (door == "dt2") { positioner = 10000; } else if (door == "parallel") { interframeWidth = (0.033 * doorRef) / stalenPart + frameSize; interframeHeight = frameSize * 0.5; interframeWidth2 = frameSize * 0.5; interframeHeight2 = 0.043 * height; interframeWidth3 = frameSize * 0.5; interframeHeight3 = 0.005 * height; positioner = 2.5; positioner2 = -4; } else if (door == "notaris") { interframeWidth = (0.043 * doorRef) / stalenPart + frameSize; interframeHeight = frameSize * 0.5; interframeWidth2 = frameSize * 0.5; interframeHeight2 = doorHeightn - (doorWidth - interframeWidth) + frameSize; interframeWidth3 = frameSize * 0.5; interframeHeight3 = (doorWidth - interframeWidth) / 2; positioner = 2.5; positioner2 = -4; } else { positioner = 3.5; } if (door == "boerderij" || door == "4panel" || door == "2panel") { positioner2 = 10000; } else if (door == "dt3") { positioner2 = -8.5; } else { positioner2 = -4; } } else if (door == "lucas" || door == "karel" || door == "annelot") { interframeWidth = doorWidth + frameSize; interframeHeight = frameSize * 0.5; interframeWidth2 = frameSize * 0.5; interframeHeight2 = 0.053 * height; positioner = 12; positioner2 = -4; } else if ( door == "govert" || door == "rembrandt" || door == "low-deep" || door == "dt2" ) { interframeWidth = doorWidth + frameSize; interframeHeight = frameSize * 0.5; interframeWidth2 = frameSize * 0.5; interframeHeight2 = 0.053 * height; positioner2 = -4; } else { positioner = 0; positioner2 = 0; interframeWidth = 0; interframeHeight = 0; interframeWidth2 = 0; interframeHeight2 = 0; } const radius = (doorWidth - interframeWidth) / 2; // Radius of the half-circle // Create a custom shape resembling a half-circle const halfCircleShape = new THREE.Shape(); halfCircleShape.moveTo(0, radius); halfCircleShape.absarc(0, 0, radius, 0, Math.PI, false); // Define extrude settings const extrudeSettings = { steps: 2, // Number of steps for extrusion depth: interframeDepth, // Depth of extrusion bevelEnabled: false, // Disable beveling }; const radiusn = 0.01 * height; // Define the radius of the circle const segments = 5; // Define the number of segments in the circle const path = new CustomCircleCurve(radiusn, segments, 0.7); const dt7Radiusn = doorWidth * 1.6; // Define the radius of the circle const dt7Path = new CustomCircleCurve(dt7Radiusn, segments, 0.5); const dt7Path2 = new CustomCircleCurve(dt7Radiusn, segments); const dt7Radius = dt7Path2.getPoint(1).x; const dt8Radiusn = doorWidth * 1.65; // Define the radius of the circle const dt8Path = new CustomCircleCurve(dt8Radiusn, segments); const dt8Radius = dt8Path.getPoint(1).x; const dt9Radiusn = 0.012 * height; const dt9Path = new CustomCircleCurve(dt9Radiusn, segments, 0.5); const dt9Radius = dt9Path.getPoint(1).y; const kasteelRadiusn = doorWidth * (2 / 3) * 2; // Define the radius of the circle const kasteelPath = new CustomCircleCurve(kasteelRadiusn, segments, 0.5); const kasteelPath2 = new CustomCircleCurve(kasteelRadiusn, segments); const kasteelRadius = kasteelPath2.getPoint(1).x; const prisonRadiusn = doorWidth * (2.5 / 3) * 2; // Define the radius of the circle const prisonPath = new CustomCircleCurve(prisonRadiusn, segments, 0.5); const prisonPath2 = new CustomCircleCurve(prisonRadiusn, segments); const prisonRadius = prisonPath2.getPoint(1).x; const curvedRadiusn = doorWidth * (1 / 3) * 2; // Define the radius of the circle const curvedPath = new CustomCircleCurve(curvedRadiusn, segments, 0.5); const curvedPath2 = new CustomCircleCurve(curvedRadiusn, segments); const curvedRadius = curvedPath2.getPoint(1).x; const bakuRadiusn = doorWidth * (1 / 2) * 2; // Define the radius of the circle const bakuPath = new CustomCircleCurve(bakuRadiusn, segments, 0.5); const bakuPath2 = new CustomCircleCurve(bakuRadiusn, segments); const bakuRadius = bakuPath2.getPoint(1).x; const supremeRadiusn = doorWidth * (1 / 2) * 2; // Define the radius of the circle const supremePath = new CustomCircleCurve(supremeRadiusn, segments, 0.5); const supremePath2 = new CustomCircleCurve(supremeRadiusn, segments); const supremeRadius = supremePath2.getPoint(1).x; const ultimate1Radiusn = doorWidth * (1.1 / 2) * 2; // Define the radius of the circle const ultimate1Path = new CustomCircleCurve(ultimate1Radiusn, segments, 0.5); const ultimate1Path2 = new CustomCircleCurve(ultimate1Radiusn, segments); const ultimate1Radius = ultimate1Path2.getPoint(1).x; const ultimate2Radiusn = doorWidth * (1 / 2) * 2; // Define the radius of the circle const ultimate2Path = new CustomCircleCurve(ultimate2Radiusn, segments, 0.5); const ultimate2Path2 = new CustomCircleCurve(ultimate2Radiusn, segments); const ultimate2Radius = ultimate2Path2.getPoint(1).x; const ultimate3Radiusn = doorWidth * (1 / 4) * 2; // Define the radius of the circle const ultimate3Path = new CustomCircleCurve(ultimate3Radiusn, segments, 0.5); const ultimate3Path2 = new CustomCircleCurve(ultimate3Radiusn, segments); const ultimate3Radius = ultimate3Path2.getPoint(1).x; const fisherAngle = Math.asin(doorWidth * 2 / doorHeightn) * (180 / Math.PI); const eliteAngle1 = Math.asin((0.8 + frameSize) / (2.4 + frameSize)) * (180 / Math.PI) const eliteAngle2 = Math.asin(0.4 / (2.4 + frameSize)) * (180 / Math.PI); const eliteTotalAngle = (360 - eliteAngle1 * 4 - eliteAngle2 * 4) / 4; const fishermanRadiusn = 1.01 *doorHeightn / 2 * 2; // Define the radius of the circle const fishermanPath = new CustomCircleCurve(fishermanRadiusn, segments, fisherAngle / 180); const fishermanPath2 = new CustomCircleCurve(fishermanRadiusn, segments); const fishermanRadius = fishermanPath2.getPoint(1).x; const elite1Radiusn = (1.6 + frameSize) * 2; // Define the radius of the circle const elite1Path = new CustomCircleCurve(elite1Radiusn, segments, 0.5); const elite1Path2 = new CustomCircleCurve(elite1Radiusn, segments); const elite1Radius = elite1Path2.getPoint(1).x; const elite2Radiusn = (2.4 + 1.5 * frameSize) * 2; // Define the radius of the circle const elite2Path = new CustomCircleCurve(elite2Radiusn, segments, eliteTotalAngle / 180); const elite2Path2 = new CustomCircleCurve(elite2Radiusn, segments); const elite2Radius = elite2Path2.getPoint(1).x; let dt10Or13Radius = 0.0075 * height; if (door == "porto") { const fixedDoorWidth = interframeWidth; xPosition[0] = Math.abs(fixedDoorWidth / positioner2); unitWidth[1] = fixedDoorWidth - xPosition[0] - dt9Radius / 2 - 4 * frameSize; unitWidth[2] = (fixedDoorWidth - xPosition[0]) / 2 + (xPosition[0] * 0.8) / 2; xPosition[1] = xPosition[0] / 2 + dt9Radius / 2; xPosition[2] = -(fixedDoorWidth - unitWidth[2] + dt9Radius) / 2; xPosition[3] = -fixedDoorWidth / 2 + unitWidth[2]; xPosition[5] = xPosition[0] - dt9Radius; xPosition[6] = xPosition[3] - dt9Radius; unitHeight[3] = (doorHeightn - xPosition[0]) / 2 - dt9Radius; unitHeight[4] = interframeHeight2 - xPosition[0] - dt9Radius; yPosition[1] = doorHeightn / 2 - xPosition[0]; yPosition[3] = -(doorHeightn - unitHeight[3]) / 2; yPosition[4] = -xPosition[0] / 2 - dt9Radius / 2; yPosition[5] = yPosition[1] - dt9Radius; yPosition[6] = -xPosition[0] / 2 - dt9Radius; unitWidth[2] = unitWidth[2] - dt9Radius; } else if (door == "rivera") { xPosition[0] = xPosition[2] = Math.abs(interframeWidth / positioner2); xPosition[1] = xPosition[3] = -Math.abs(interframeWidth / positioner2); dt10Or13Radius = interframeWidth - xPosition[0] * 2; unitHeight[0] = unitHeight[1] = doorHeightn * (isSide ? 0.55 : 0.4) - dt10Or13Radius / 2; unitHeight[2] = unitHeight[3] = doorHeightn * (isSide ? 0.4 : 0.55) - dt10Or13Radius / 2; yPosition[0] = yPosition[1] = -(doorHeightn - unitHeight[0]) / 2; yPosition[2] = yPosition[3] = (doorHeightn - unitHeight[2]) / 2; yPosition[5] = -doorHeightn / 2 + unitHeight[0]; yPosition[6] = doorHeightn / 2 - unitHeight[2]; } else if (door == "dt13") { xPosition[0] = Math.abs(interframeWidth / positioner2); xPosition[1] = -Math.abs(interframeWidth / positioner2); dt10Or13Radius = interframeWidth - xPosition[0] * 2; unitHeight[0] = unitHeight[1] = doorHeightn - 2 * xPosition[0] - dt10Or13Radius / 2; unitWidth[4] = unitWidth[5] = xPosition[0]; xPosition[4] = interframeWidth / 2 - unitWidth[4] / 2; xPosition[5] = -xPosition[4]; yPosition[0] = yPosition[1] = 0; yPosition[2] = unitHeight[0] / 2; yPosition[3] = -unitHeight[0] / 2; yPosition[4] = yPosition[5] = 0; } else if (door == "dt11" || door == "boender") { xPosition[0] = (interframeWidth - (2 * interframeWidth) / 3) / 2 + frameSize / 2; unitWidth[0] = interframeWidth / 3; xPosition[1] = -interframeWidth / 2 + unitWidth[0] / 2; if (door == "boender") { yPosition[1] = doorHeightn / 2 / 1.6; } } else if (door == "fabric") { unitWidth[0] = interframeWidth; yPosition[0] = -doorHeightn / 4; yPosition[1] = -doorHeightn / 6.5; unitHeight[3] = doorHeightn / 2 - yPosition[1]; unitHeight[4] = doorHeightn / 2 + yPosition[0]; yPosition[3] = doorHeightn / 4 + yPosition[1] / 2; yPosition[4] = -doorHeightn / 2 - yPosition[0] / 2; } else if (door == "larino") { unitWidth[0] = interframeWidth / 2; } else if (door == "toog") { xPosition[0] = xPosition[2] = Math.abs(interframeWidth / 3); xPosition[1] = xPosition[3] = -Math.abs(interframeWidth / 3); dt10Or13Radius = xPosition[0] * 2; unitHeight[0] = unitHeight[1] = doorHeightn * 0.92 - dt10Or13Radius / 2; unitHeight[2] = unitHeight[3] = doorHeightn * (isSide ? 0.4 : 0.55) - dt10Or13Radius / 2; yPosition[0] = yPosition[1] = -(doorHeightn - unitHeight[0]) / 2; yPosition[2] = -doorHeightn / 2 + unitHeight[0]; } else if (door == "larino1") { xPosition[0] = doorWidth / 3.5; unitWidth[1] = -doorWidth / 4.5; unitHeight[1] = unitWidth[1] * 1.5; yPosition[1] = unitHeight[1] / 2; xPosition[1] = interframeWidth / 2 + unitWidth[1] / 2; } else if (door == "grandma") { yPosition[0] = (doorHeightn / 2) * 0.85; yPosition[1] = -(doorHeightn / 2) * 0.85 + frameSize; xPosition[2] = interframeWidth / 2 - (doorHeightn / 2) * 0.15; xPosition[3] = -(interframeWidth / 2 - (doorHeightn / 2) * 0.15); } else if (door == "80s") { yPosition[0] = (doorHeightn / 2) * 0.65; yPosition[1] = -(doorHeightn / 2) * 0.65 + frameSize; xPosition[2] = interframeWidth / 2 - (doorHeightn / 2) * 0.15; xPosition[3] = -(interframeWidth / 2 - (doorHeightn / 2) * 0.15); } else if (door == "staldeuren") { yPosition[0] = doorHeightn / 4; yPosition[1] = 0; yPosition[2] = -doorHeightn / 4; yPosition[3] = -doorHeightn / 4 - doorHeightn / 8; unitHeight[3] = doorHeightn / 4; } else if (door == "contempera") { dt10Or13Radius = interframeWidth / 9; xPosition[0] = xPosition[2] = xPosition[5] = xPosition[7] = interframeWidth / 2 - interframeWidth / 3; xPosition[1] = xPosition[3] = xPosition[4] = xPosition[6] = -(interframeWidth / 2 - interframeWidth / 3); xPosition[8] = xPosition[1] - dt10Or13Radius / 2; xPosition[9] = xPosition[1] + dt10Or13Radius / 2; xPosition[10] = xPosition[0] - dt10Or13Radius / 2; xPosition[11] = xPosition[0] + dt10Or13Radius / 2; unitHeight[0] = unitHeight[1] = unitHeight[2] = unitHeight[3] = doorHeightn / 6; unitHeight[8] = unitHeight[9] = unitHeight[10] = unitHeight[11] = doorHeightn - 2 * unitHeight[0] - dt10Or13Radius + frameSize; yPosition[0] = yPosition[1] = doorHeightn / 2 - unitHeight[0] / 2; yPosition[2] = yPosition[3] = -(doorHeightn / 2 - unitHeight[0] / 2); yPosition[4] = yPosition[5] = doorHeightn / 2 - unitHeight[0] - dt10Or13Radius / 2; yPosition[6] = yPosition[7] = -( doorHeightn / 2 - unitHeight[0] - dt10Or13Radius / 2 ); yPosition[8] = yPosition[9] = yPosition[10] = yPosition[11] = 0; yPosition[12] = doorHeightn / 2 - unitHeight[0] - dt10Or13Radius / 6 + 0.07; yPosition[13] = -(doorHeightn / 2 - unitHeight[0] - dt10Or13Radius / 6) - 0.07; } else if (door == "annelot") { const gapWidth = doorWidth / positioner2; yPosition[1] = -(doorHeightn / 2 - 105 * 0.053); yPosition[2] = yPosition[1] + gapWidth; } else if (door == "kasteel") { unitHeight[2] = doorHeightn - 2.3 + kasteelRadius + kasteelRadius / 6; unitHeight[3] = doorHeightn - 2.3 / 2 + kasteelRadius; yPosition[0] = doorHeightn / 2 + kasteelRadius - 1.2; yPosition[1] = -doorHeightn / 2 - kasteelRadius + 1.2; yPosition[2] = doorHeightn / 2 - unitHeight[2] / 2 + kasteelRadius - 1.15; yPosition[3] = -doorHeightn / 2 + unitHeight[3] / 2 - kasteelRadius + 1.14; yPosition[4] = -doorHeightn / 2 + 1.2; xPosition[1] = -doorWidth / 2; xPosition[2] = doorWidth / 2 + kasteelRadius + frameSize; xPosition[3] = -doorWidth / 2 - kasteelRadius; xPosition[4] = 0; } else if (door == "kathedraal") { unitHeight[1] = doorHeightn + kasteelRadius - 1.2; const radianDiff = -kasteelRadius + 1.2 - doorHeightn / 3 > 0 ? (-kasteelRadius + 1.2 - doorHeightn / 3) / 4.5 : 0; unitWidth[2] = doorWidth / 3 + radianDiff + frameSize; unitWidth[3] = doorWidth / 3 + frameSize; yPosition[0] = doorHeightn / 2 + kasteelRadius - 1.2; yPosition[1] = doorHeightn / 2 - unitHeight[1] / 2 + kasteelRadius - 1.2; yPosition[2] = yPosition[4] = doorHeightn / 2 - doorHeightn / 3; yPosition[3] = yPosition[5] = -doorHeightn / 2 + doorHeightn / 3; xPosition[1] = doorWidth / 2 + kasteelRadius + frameSize; xPosition[2] = -doorWidth / 2 + unitWidth[2] / 2 - frameSize / 2; xPosition[3] = -doorWidth / 2 + unitWidth[3] / 2 - frameSize / 2; xPosition[4] = xPosition[5] = 0; } else if (door == "gladiator") { unitHeight[1] = doorHeightn + kasteelRadius - 1.2; const radianDiff = -kasteelRadius + 1.2 - doorHeightn / 3 > 0 ? (-kasteelRadius + 1.2 - doorHeightn / 3) / 4.5 : 0; unitWidth[2] = doorWidth / 3 + radianDiff; unitWidth[3] = doorWidth / 3; yPosition[0] = doorHeightn / 2 + kasteelRadius - 1.2; yPosition[1] = doorHeightn / 2 - unitHeight[1] / 2 + kasteelRadius - 1.2; yPosition[2] = doorHeightn / 2 - doorHeightn / 3; yPosition[3] = -doorHeightn / 2 + doorHeightn / 3; yPosition[4] = -doorHeightn / 2 + unitHeight[1] / 2; xPosition[1] = doorWidth / 2 + kasteelRadius + frameSize / 3; xPosition[2] = -doorWidth / 2 + unitWidth[2] / 2; xPosition[3] = -doorWidth / 2 + unitWidth[3] / 2; xPosition[4] = -doorWidth / 2 - kasteelRadius - frameSize / 3; xPosition[5] = doorWidth / 2 - unitWidth[2] / 2; xPosition[6] = doorWidth / 2 - unitWidth[3] / 2; } else if (door == "the-judge") { xPosition[0] = doorWidth / 2 - 1.2; xPosition[1] = doorWidth / 2 - 0.6 + frameSize / 2; yPosition[0] = 0; yPosition[1] = 0; unitWidth[1] = 1.2; unitHeight[1] = 2.4; } else if (door == "prison") { unitHeight[1] = doorHeightn + kasteelRadius - 1.2; const radianDiff = -prisonRadius + 1.2 - doorHeightn / 3 > 0 ? (-prisonRadius + 1.2 - doorHeightn / 3) / 4.5 : 0; unitWidth[2] = doorWidth / 3 + radianDiff; unitWidth[3] = doorWidth / 3; yPosition[0] = doorHeightn / 2 + prisonRadius - 1.2; yPosition[1] = doorHeightn / 2 - unitHeight[1] / 2 + prisonRadius - 1.2; yPosition[2] = yPosition[4] = doorHeightn / 2 - doorHeightn / 3; yPosition[3] = yPosition[5] = -doorHeightn / 2 + doorHeightn / 3; xPosition[1] = doorWidth / 2 + prisonRadius + frameSize; xPosition[2] = doorWidth / 2 - 1; xPosition[3] = -doorWidth / 2 + unitWidth[3] / 2; xPosition[4] = xPosition[5] = 0; } else if (door == "curved") { unitWidth[2] = unitWidth[4] = doorWidth / 2 + curvedRadius + frameSize; unitHeight[3] = doorHeightn + 2 * curvedRadius - 3.4 + frameSize; xPosition[0] = curvedRadius; xPosition[1] = -curvedRadius; xPosition[2] = -doorWidth / 2 + unitWidth[2] / 2 - frameSize; xPosition[3] = 0; xPosition[4] = doorWidth / 2 - unitWidth[4] / 2 + frameSize; xPosition[5] = -curvedRadius; xPosition[6] = curvedRadius; xPosition[7] = doorWidth / 2 - unitWidth[2] / 2 + frameSize / 2; xPosition[8] = -doorWidth / 2 + unitWidth[2] / 2 - frameSize / 2; yPosition[0] = yPosition[5] = doorHeightn / 2 + curvedRadius - 1.7; yPosition[1] = yPosition[6] = -doorHeightn / 2 - curvedRadius + 1.7; yPosition[2] = doorHeightn / 2 - 1.7; yPosition[3] = 0; yPosition[4] = -doorHeightn / 2 + 1.7; } else if (door == "lindsey") { unitHeight[2] = unitHeight[3] = doorHeightn + 2 * curvedRadius - (3 * frameSize) / 2; xPosition[0] = 0; xPosition[1] = 0; xPosition[2] = curvedRadius; xPosition[3] = -curvedRadius; xPosition[4] = xPosition[5] = -doorWidth / 2 - frameSize / 2; xPosition[6] = xPosition[7] = doorWidth / 2 + frameSize / 2; xPosition[8] = -doorWidth / 2 - curvedRadius - frameSize / 2; xPosition[9] = doorWidth / 2 + curvedRadius + frameSize / 2; yPosition[0] = doorHeightn / 2 + curvedRadius; yPosition[1] = -(doorHeightn / 2 + curvedRadius) + frameSize * 2; yPosition[2] = frameSize; yPosition[3] = yPosition[8] = yPosition[9] = frameSize; yPosition[4] = yPosition[6] = doorHeightn / 2 + curvedRadius; yPosition[5] = yPosition[7] = -doorHeightn / 2 - curvedRadius + frameSize * 2; } else if (door == "baku") { unitHeight[3] = doorHeightn + bakuRadius; xPosition[0] = xPosition[1] = xPosition[2] = xPosition[3] = 0; yPosition[0] = yPosition[1] = doorHeightn / 2 + bakuRadius; yPosition[2] = yPosition[1] - 1.2; yPosition[3] = -doorHeightn / 2 + unitHeight[3] / 2; } else if (door == "supreme") { unitHeight[3] = doorHeightn + bakuRadius; xPosition[0] =xPosition[3] = -doorWidth / 2; xPosition[1] =xPosition[4] = doorWidth / 2; xPosition[2] = 0; yPosition[0] = yPosition[1] = doorHeightn / 2 + bakuRadius; yPosition[2] = -doorHeightn / 2 + unitHeight[3] / 2; yPosition[3] = yPosition[3] = -doorHeightn / 2 - supremeRadius; } else if (door == "ultimate") { unitHeight[1] = 2 * doorHeightn / 3 + 4 * frameSize; unitHeight[10] = 2 * doorHeightn / 3 + ultimate2Radius; unitHeight[11] = doorHeightn / 3 + ultimate3Radius; unitWidth[2] = doorWidth / 6; unitWidth[3] = doorWidth / 3; unitWidth[6] = unitWidth[7] = doorWidth / 6 + 4 * frameSize; unitWidth[12] = doorWidth / 4; yPosition[0] = -doorHeightn / 2 + unitHeight[1]; yPosition[1] = -doorHeightn / 2 + unitHeight[1] / 2; yPosition[2] = yPosition[4] = yPosition[6] = doorHeightn / 2 - doorHeightn / 3; yPosition[3] = yPosition[5] = -doorHeightn / 2 + doorHeightn / 3; yPosition[8] = doorHeightn / 2 - doorHeightn / 3 + ultimate2Radius; yPosition[9] = -doorHeightn / 2 + doorHeightn / 3 + ultimate3Radius; yPosition[10] = -doorHeightn / 2 + unitHeight[10] / 2; yPosition[11] = -doorHeightn / 2 + unitHeight[11] / 2; yPosition[12] = -doorHeightn / 2 + unitHeight[1] - ultimate1Radius; xPosition[0] = -doorWidth / 2 + doorWidth / 4 - ultimate1Radius; xPosition[1] = -doorWidth / 2 + doorWidth / 4; xPosition[2] = doorWidth / 2 - 1 - ultimate1Radius; xPosition[3] = -doorWidth / 2 + unitWidth[3] / 2; xPosition[4] = xPosition[5] = 0; xPosition[6] = xPosition[7] = -doorWidth / 2 + unitWidth[6] / 2; xPosition[8] = xPosition[9] = -doorWidth / 2 + unitWidth[6]; xPosition[10] = -doorWidth / 2 + unitWidth[6] - ultimate2Radius; xPosition[11] = -doorWidth / 2 + unitWidth[6] - ultimate3Radius; xPosition[12] = doorWidth / 2 - unitWidth[12] / 2; } else if (door == "fisherman") { xPosition[0] = xPosition[1] = 0; xPosition[2] = -doorWidth / 2; xPosition[3] = -doorWidth / 2; yPosition[0] = 0; yPosition[1] = -doorWidth / Math.tan(fisherAngle) yPosition[2] = fishermanRadius; yPosition[3] = doorHeightn / 2 -doorWidth / Math.tan(fisherAngle) } else if (door == "primier") { unitHeight[1] = doorHeightn + kasteelRadius - 1.2; const radianDiff = -kasteelRadius + 1.2 - doorHeightn / 3 > 0 ? (-kasteelRadius + 1.2 - doorHeightn / 3) / 4.5 : 0; unitWidth[2] = doorWidth + frameSize; unitWidth[3] = doorWidth + frameSize; yPosition[0] = doorHeightn / 2 + kasteelRadius - 1.2; yPosition[1] = doorHeightn / 2 - unitHeight[1] / 2 + kasteelRadius - 1.2; yPosition[2] = yPosition[4] = doorHeightn / 2 - doorHeightn / 3; yPosition[3] = yPosition[5] = -doorHeightn / 2 + doorHeightn / 3; xPosition[1] = doorWidth / 2 + kasteelRadius + frameSize; xPosition[2] = -doorWidth / 2 + unitWidth[2] / 2 - frameSize / 2; xPosition[3] = -doorWidth / 2 + unitWidth[3] / 2 - frameSize / 2; xPosition[4] = xPosition[5] = 0; } else if (door == "elite") { unitWidth[0] = doorWidth - 1.6; unitWidth[3] = unitWidth[5] = unitWidth[0] - 1.6 + frameSize / 2; unitHeight[1] = doorHeightn / 2 - 1.2; unitHeight[4] = unitHeight[5] = unitHeight[1] - 2 + frameSize; unitHeight[8] = unitHeight[1] - 2; xPosition[0] = 0; xPosition[1] = -doorWidth / 2 + 0.8; xPosition[2] = doorWidth / 2 + frameSize / 2; xPosition[3] = xPosition[5] = -doorWidth / 2 + 0.8 + unitWidth[3] / 2 - frameSize / 2; xPosition[4] = unitWidth[0] / 2; xPosition[10] = doorWidth / 2 - 0.8 + 0.8 + frameSize; xPosition[11] = doorWidth / 2 + frameSize; yPosition[0] = doorHeightn / 2 - 0.8; yPosition[1] = doorHeightn / 2 - unitHeight[1] / 2 - 0.8 + frameSize / 2; yPosition[2] = -frameSize / 2; yPosition[3] = 0.4; yPosition[4] = 2 + unitHeight[4] / 2 + 0.4 - frameSize / 2; yPosition[5] = -0.4; yPosition[6] = -doorHeightn / 2 + unitHeight[1] / 2 + 0.8 + frameSize / 2; yPosition[7] = -doorHeightn / 2 + 0.8 + frameSize; yPosition[8] = -doorHeightn / 2 + unitHeight[8] / 2 + 0.8 + frameSize / 2; yPosition[10] = 0; yPosition[11] = 0; } const dt10Or13Path = new CustomCircleCurve(dt10Or13Radius, segments, 1); const contemperaRoundness = new CustomCircleCurve( dt10Or13Radius / 3, segments, 1 ); return ( <> {/* Right Frame */} {/* Top Frame */} {/* Bottom Frame */} {/* Door */} {(door == "rembrandt" || door == "karel" || door == "herenhuis" || door == "elody" || door == "boerderij" || door == "dt2") && ( )} {door == "3pannel" && ( )} {door == "drentse" && ( <> )} {door == "3panel" && ( <> )} {(door == "herman" || door == "lucas" || door == "karel" || door == "herenhuis" || door == "elody" || door == "3pannel" || door == "drentse" || door == "4panel" || door == "boerderij" || door == "dt3" || door == "dt2" || door == "parallel" || door == "notaris" || door == "dt11") && ( <> {door == "parallel" || door == "notaris" ? ( !isSide && ( ) ) : ( )} {door != "dt2" && (door == "parallel" || door == "notaris" ? ( !isSide && ( ) ) : ( ))} )} {(door == "4panel" || door == "boerderij" || door == "govert" || door == "rembrandt" || door == "2panel") && ( <> )} {door == "dt3" && ( <> )} {door == "annelot" && ( <> {!isSide && ( )} )} {door == "low-deep" && ( <> )} {door == "staldeuren" && ( <> )} {(door == "parallel" || door == "notaris") && ( <> {door != "notaris" && !isSide && ( <> )} {!isSide && ( <> )} {door == "notaris" && !isSide ? ( <> ) : ( isSide && ( ) )} )} {door == "toogPlus" && !isSide && ( <> )} {door == "larino2" && ( <> )} {door == "fabric" && ( <> )} {door == "larino" && ( <> {!isSide && ( )} )} {door == "toog" && ( <> )} {door == "contempera" && !isSide && ( <> )} {door == "grandma" && ( <> )} {door == "80s" && ( <> )} {(door == "rondPlus" || door == "rond") && ( <> {door == "rondPlus" && ( )} {!isSide && ( )} )} {door == "porto" && ( <> {!isSide && ( <> )} )} {door == "rivera" && ( <> )} {door == "dt13" && ( <> {!isSide && ( <> )} )} {(door == "dt11" || door == "boender") && ( <> )} {door == "boender" && ( <> {/* left col */} {/* Middle col */} {/* Right col */} )} {door == "kasteel" && (isSide ? ( ) : ( <> ))} {door == "kathedraal" && (isSide ? ( <> ) : ( <> ))} {door == "gladiator" && (isSide ? ( <> ) : ( <> ))} {door == "the-judge" && !isSide && ( <> )} {door == "prison" && (isSide ? ( <> ) : ( <> ))} {door == "curved" && (isSide ? ( <> ) : ( <> ))} {door == "lindsey" && ( <> )} {door == "baku" && ( <> )} {door == "supreme" && ( <> )} {door == "ultimate" && (isSide ? ( <> ) : ( <> ))} {door == "fisherman" && (isSide ? ( <> ) : ( <> ))} {door == "primier" && (isSide ? ( <> ) : ( <> ))} {door == "elite" && (isSide ? ( <> ) : ( <> ))} ); }