public JigsawSide CreateSpouse(float pieceHeight) { JigsawSide spouse = new JigsawSide(); spouse.leftBiz = new ThreePointBezier2D { pointA = leftBiz.pointA, pointB = new Vector2(leftBiz.pointB.x, pieceHeight - leftBiz.pointB.y), pointC = leftBiz.pointC, }; spouse.rightBiz = new ThreePointBezier2D { pointA = rightBiz.pointA, pointB = new Vector2(rightBiz.pointB.x, pieceHeight - rightBiz.pointB.y), pointC = rightBiz.pointC, }; spouse.middleLeftBiz = new ThreePointBezier2D { pointA = middleLeftBiz.pointA, pointB = new Vector2(middleLeftBiz.pointB.x, pieceHeight - middleLeftBiz.pointB.y), pointC = new Vector2(middleLeftBiz.pointC.x, pieceHeight - middleLeftBiz.pointC.y), }; spouse.middleRightBiz = new ThreePointBezier2D { pointA = new Vector2(middleRightBiz.pointA.x, pieceHeight - middleRightBiz.pointA.y), pointB = new Vector2(middleRightBiz.pointB.x, pieceHeight - middleRightBiz.pointB.y), pointC = middleRightBiz.pointC, }; return(spouse); }
public static JigsawSide CreateGenitalia(float pieceWidth, float pieceHeight, bool protrude = true, float percentSideDip = 0.2f, float girthPercent = 0.3f, float growthPercent = 0.5f, float lengthPercent = 0.5f, float dipPlacement = 0.9f, float growthPlacement = 0.9f) { var jigSide = new JigsawSide(); float halfWidth = pieceWidth / 2; float halfHeight = pieceHeight / 2; float maxDippage = halfHeight * 0.9f; float dipAmount = maxDippage * Mathf.Clamp01(percentSideDip); //The dip that happens before the penis float maxGirth = halfWidth * 0.9f; float girthAmount = maxGirth * Mathf.Clamp01(girthPercent); //How wide the penis is at the base float growthAmount = maxGirth * Mathf.Clamp01(growthPercent); //How wide the penis can grow on the way to the tip float maxLength = halfHeight * 0.9f; float lengthAmount = maxLength * Mathf.Clamp01(lengthPercent); //How long the penis is float dipPos = Mathf.Lerp(halfWidth, girthAmount, Mathf.Clamp01(dipPlacement)); float growthPos = Mathf.Lerp(0, lengthAmount, Mathf.Clamp01(growthPlacement)); dipAmount = dipAmount * (protrude ? 1 : -1); lengthAmount = lengthAmount * (protrude ? 1 : -1); growthPos = growthPos * (protrude ? 1 : -1); jigSide.leftBiz = new ThreePointBezier2D { pointA = new Vector2(-halfWidth, halfHeight), pointB = new Vector2(-dipPos, halfHeight - dipAmount), pointC = new Vector2(-girthAmount, halfHeight), }; jigSide.rightBiz = new ThreePointBezier2D { pointA = new Vector2(girthAmount, halfHeight), pointB = new Vector2(dipPos, halfHeight - dipAmount), pointC = new Vector2(halfWidth, halfHeight), }; jigSide.middleLeftBiz = new ThreePointBezier2D { pointA = new Vector2(-girthAmount, halfHeight), pointB = new Vector2(-growthAmount, halfHeight + growthPos), pointC = new Vector2(0, halfHeight + lengthAmount), }; jigSide.middleRightBiz = new ThreePointBezier2D { pointA = new Vector2(0, halfHeight + lengthAmount), pointB = new Vector2(growthAmount, halfHeight + growthPos), pointC = new Vector2(girthAmount, halfHeight), }; return(jigSide); }
//Good Ranges dip[0.08, 0.5] girth[0.06, 0.3] growth[0.5, 1] length[0.3, 0.6] dipP[0.2, 1] growthP[0.88, 1] public static JigsawPiece GenerateRandom(float pieceWidth, float pieceHeight, float seed = 1337, float posX = 0, float posY = 0, float dipRangeStart = 0.08f, float dipRangeEnd = 0.5f, float girthRangeStart = 0.06f, float girthRangeEnd = 0.3f, float growthRangeStart = 0.5f, float growthRangeEnd = 1, float lenghRangeStart = 0.3f, float lengthRangeEnd = 0.6f, float dipPRangeStart = 0.2f, float dipPRangeEnd = 1, float growthPRangeStart = 0.88f, float growthPRangeEnd = 1 ) { JigsawPiece randomizedBizaz = new JigsawPiece(); randomizedBizaz.pieceWidth = pieceWidth; randomizedBizaz.pieceHeight = pieceHeight; var pieceNoise = Mathf.PerlinNoise(posX + pieceWidth * seed * 1879, posY + pieceHeight * seed * 1033); var bizProtrude = Mathf.RoundToInt(pieceNoise * 10) % 2 == 0; var bizDip = (dipRangeEnd - dipRangeStart) * pieceNoise + dipRangeStart; var bizGirth = (girthRangeEnd - girthRangeStart) * pieceNoise + girthRangeStart; var bizGrowth = (growthPRangeEnd - growthRangeStart) * pieceNoise + growthRangeStart; var bizLength = (lengthRangeEnd - lenghRangeStart) * pieceNoise + lenghRangeStart; var bizDipP = (dipPRangeEnd - dipPRangeStart) * pieceNoise + dipPRangeStart; var bizGrowthP = (growthPRangeEnd - growthPRangeStart) * pieceNoise + growthPRangeStart; randomizedBizaz.left = JigsawSide.CreateGenitalia ( pieceHeight, pieceWidth, bizProtrude, bizDip, bizGirth, bizGrowth, bizLength, bizDipP, bizGrowthP ); pieceNoise = Mathf.PerlinNoise(posX + pieceWidth * seed * 1607, posY + pieceHeight * seed * 1571); bizProtrude = Mathf.RoundToInt(pieceNoise * 10) % 2 == 0; bizDip = (dipRangeEnd - dipRangeStart) * pieceNoise + dipRangeStart; bizGirth = (girthRangeEnd - girthRangeStart) * pieceNoise + girthRangeStart; bizGrowth = (growthPRangeEnd - growthRangeStart) * pieceNoise + growthRangeStart; bizLength = (lengthRangeEnd - lenghRangeStart) * pieceNoise + lenghRangeStart; bizDipP = (dipPRangeEnd - dipPRangeStart) * pieceNoise + dipPRangeStart; bizGrowthP = (growthPRangeEnd - growthPRangeStart) * pieceNoise + growthPRangeStart; randomizedBizaz.right = JigsawSide.CreateGenitalia ( pieceHeight, pieceWidth, bizProtrude, bizDip, bizGirth, bizGrowth, bizLength, bizDipP, bizGrowthP ); pieceNoise = Mathf.PerlinNoise(posX + pieceWidth * seed * 2113, posY + pieceHeight * seed * 461); bizProtrude = Mathf.RoundToInt(pieceNoise * 10) % 2 == 0; bizDip = (dipRangeEnd - dipRangeStart) * pieceNoise + dipRangeStart; bizGirth = (girthRangeEnd - girthRangeStart) * pieceNoise + girthRangeStart; bizGrowth = (growthPRangeEnd - growthRangeStart) * pieceNoise + growthRangeStart; bizLength = (lengthRangeEnd - lenghRangeStart) * pieceNoise + lenghRangeStart; bizDipP = (dipPRangeEnd - dipPRangeStart) * pieceNoise + dipPRangeStart; bizGrowthP = (growthPRangeEnd - growthPRangeStart) * pieceNoise + growthPRangeStart; randomizedBizaz.top = JigsawSide.CreateGenitalia ( pieceWidth, pieceHeight, bizProtrude, bizDip, bizGirth, bizGrowth, bizLength, bizDipP, bizGrowthP ); pieceNoise = Mathf.PerlinNoise(posX + pieceWidth * seed * 569, posY + pieceHeight * seed * 3209); bizProtrude = Mathf.RoundToInt(pieceNoise * 10) % 2 == 0; bizDip = (dipRangeEnd - dipRangeStart) * pieceNoise + dipRangeStart; bizGirth = (girthRangeEnd - girthRangeStart) * pieceNoise + girthRangeStart; bizGrowth = (growthPRangeEnd - growthRangeStart) * pieceNoise + growthRangeStart; bizLength = (lengthRangeEnd - lenghRangeStart) * pieceNoise + lenghRangeStart; bizDipP = (dipPRangeEnd - dipPRangeStart) * pieceNoise + dipPRangeStart; bizGrowthP = (growthPRangeEnd - growthPRangeStart) * pieceNoise + growthPRangeStart; randomizedBizaz.bottom = JigsawSide.CreateGenitalia ( pieceWidth, pieceHeight, bizProtrude, bizDip, bizGirth, bizGrowth, bizLength, bizDipP, bizGrowthP ); return(randomizedBizaz); }