Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #declare line = 0;
- #declare parabola = 1;
- #declare hyperbola = 2;
- #declare sine = 3;
- #declare cosine = 4;
- #declare tangent = 5;
- #declare logarithm = 6;
- #declare naturalLogarithm = 7;
- #declare category = parabola;
- //-----------------------------------
- #declare graphHeight = 50;
- #declare graphWidth = 50;
- #declare incrementX = -graphWidth / 2;
- #declare incrementY = -graphHeight / 2;
- #declare gridWidth = 0.07;
- #declare gridDepth = 0.5;
- #declare axesWidth = 0.5;
- #declare axesDepth = 2.5;
- #declare gridSpacing = 2;
- #declare tickMarkLength = 1.5;
- #declare graphXPos = incrementX;
- #declare graphYPos = incrementY;
- #declare elementsZPos = -axesDepth / 2;
- #declare pointCloseness = 0.1;
- camera
- {
- location <0, 0, -graphHeight * 3>
- look_at <0, 0, 0>
- }
- light_source
- {
- <0, 0, -graphHeight>
- color rgb <1, 1, 1>
- }
- #while (incrementY <= graphHeight / 2)
- #while (incrementX <= graphWidth / 2)
- box
- {
- <(incrementX) - (gridWidth / 2), -tickMarkLength / 2, -gridDepth / 2>
- <(incrementX) + (gridWidth / 2), tickMarkLength / 2, gridDepth / 2>
- pigment
- {
- color rgb <1, 1, 1>
- }
- }
- #declare incrementX = incrementX + 1;
- #end
- box
- {
- <-tickMarkLength / 2, incrementY - (gridWidth / 2), -gridDepth / 2>
- <tickMarkLength / 2, incrementY + (gridWidth / 2) , gridDepth / 2>
- pigment
- {
- color rgb <1, 1, 1>
- }
- }
- #declare incrementY = incrementY + 1;
- #end
- box
- {
- <-axesWidth / 2, -(graphHeight / 2), -axesDepth / 2>
- <axesWidth / 2, graphHeight / 2, axesDepth / 2>
- pigment
- {
- color rgb <1, 0, 0>
- }
- }
- box
- {
- <-(graphWidth / 2), -axesWidth / 2 , -axesDepth / 2>
- <(graphWidth / 2), axesWidth / 2, axesDepth / 2>
- pigment
- {
- color rgb <1, 0, 0>
- }
- }
- #if (category = line)
- #declare varX = 0;
- #declare varY = 0;
- #declare varSlope = 2;
- #declare varYIntercept = 5;
- #declare varX = ((-graphYPos) - varYIntercept) / (varSlope);
- #declare varY = (varSlope * varX) + varYIntercept;
- #declare varX2 = ((graphYPos) - varYIntercept) / (varSlope);
- #declare varY2 = (varSlope * varX) + varYIntercept;
- cylinder
- {
- <varX, -graphYPos, 0>
- <varX2, graphYPos, 0>
- 0.2
- pigment
- {
- color rgb <0, 0, 1>
- }
- }
- #end
- #if (category = parabola)
- #declare upOrDown = 0;
- #declare leftOrRight = 1;
- //-------------------------------------------
- //- CHANGE THESE ONLY -----------------------
- #declare opens = leftOrRight;
- #declare varP = 5;
- #declare varH = 6;
- #declare varK = 3;
- //-------------------------------------------
- //-------------------------------------------
- #declare control = 0;
- #declare start = 0;
- #declare varX = 0;
- #declare varY = 0;
- #if (varP > 0)
- #declare posOrNeg = 1;
- #else
- #declare posOrNeg = -1;
- #end
- #if (opens = upOrDown)
- #declare start = (graphWidth / 2) * -posOrNeg;
- #declare varX = -sqrt(((4 * varP) * (graphHeight - varK))) + varH;
- #declare varX2 = sqrt(((4 * varP) * (graphHeight - varK))) + varH;
- #declare gWidth = sqrt(pow(varX2 - varX, 2));
- #declare theEnd = varX + (gWidth * ((clock) / 31));
- #declare control = varX;
- #end
- #if (opens = leftOrRight)
- #declare start = (graphHeight / 2) * -posOrNeg;
- #declare varY = ((1 / (4 * varP) * pow(((graphWidth) - varH), 2))) + varK;
- #declare varY2 = ((1 / (4 * varP) * pow(((-graphWidth) - varH), 2))) + varK;
- // #debug concat("ASDF: ", str(varY, 0, 1), " - ", str(varY2, 0, 1))
- #declare gHeight = sqrt(pow(varY2 - varY, 2));
- #declare theEnd = varY + (gHeight * ((clock) / 31));
- #declare control = varY;
- #end
- #declare goneThrough = false;
- #while (control < theEnd)
- #if (control < 0)
- #declare posOrNeg = -1;
- #else
- #declare posOrNeg = 1;
- #end
- cylinder
- {
- <varX, varY, elementsZPos>
- #if (opens = upOrDown)
- #declare varY = ((1 / (4 * varP)) * pow((varX - varH), 2)) + varK;
- #declare varX = varX + (pointCloseness);
- #end
- #if (opens = leftOrRight)
- #declare varX = sqrt(abs(((4 * varP) * (varY - varK)))) + varH;
- #declare varY = varY + (pointCloseness);
- #end
- #declare control = control + (pointCloseness);
- <varX, varY, elementsZPos>
- #if (goneThrough)
- 0.2
- #else
- 0.0
- #end
- pigment
- {
- color rgb <0, 0, 1>
- }
- }
- #declare goneThrough = true;
- #end
- #end
- #if (category = hyperbola)
- #declare upOrDown = 0;
- #declare leftOrRight = 1;
- //-------------------------------------------
- //- CHANGE THESE ONLY -----------------------
- #declare opens = upOrDown;
- #declare varP = 5;
- #declare varH = 6;
- #declare varK = -3;
- //-------------------------------------------
- //-------------------------------------------
- #declare control = 0;
- #declare start = 0;
- #declare varX = 0;
- #declare varY = 0;
- #if (varP > 0)
- #declare posOrNeg = 1;
- #else
- #declare posOrNeg = -1;
- #end
- #if (opens = upOrDown)
- #declare start = (graphHeight / 2) * -posOrNeg;
- #declare varX = sqrt(abs((4 * varP) * ((graphHeight) - varK))) + varH;
- #declare theEnd = varX;
- #declare varX = varX - (varX - varH) * 2;
- #declare control = varX;
- #declare theEnd = theEnd - ( / (30 - clock));
- #end
- #if (opens = leftOrRight)
- #declare start = (graphWidth / 2) * -posOrNeg;
- #declare varY = sqrt(abs((4 * varP) * ((graphWidth) - varH))) + varK;
- #declare theEnd = varY;
- #declare varY = varY - (varY - varK) * 2;
- #declare control = varY;
- #declare theEnd = theEnd - ( / (30 - clock));
- #end
- #declare goneThrough = false;
- #while (control < theEnd)
- cylinder
- {
- <varX, varY, elementsZPos>
- #if (opens = upOrDown)
- #declare varY = ((1 / (4 * varP)) * ((varX - varH) * (varX - varH))) + varK;
- #declare varX = varX + (pointCloseness);
- #end
- #if (opens = leftOrRight)
- #declare varX = ((1 / (4 * varP)) * ((varY - varK) * (varY - varK))) + varH;
- #declare varY = varY + (pointCloseness);
- #end
- #declare control = control + (pointCloseness);
- <varX, varY, elementsZPos>
- #if (goneThrough)
- 0.2
- #else
- 0.0
- #end
- pigment
- {
- color rgb <0, 0, 1>
- }
- }
- #declare goneThrough = true;
- #end
- #end
- #if (category = sine)
- #declare varNum = 2;
- #declare varPow = 1;
- #declare varSinCooff = 8;
- #declare varX = -graphWidth;
- #declare varY = 0;
- #declare goneThrough = false;
- #while (varX < graphWidth)
- cylinder
- {
- <varX, varY, elementsZPos>
- #declare varY = varSinCooff * sin(varNum + pow(varX, varPow));
- #declare varX = varX + pointCloseness;
- <varX, varY, elementsZPos>
- #if (goneThrough)
- 0.2
- #else
- 0.0
- #end
- pigment
- {
- color rgb <0, 0, 1>
- }
- }
- #declare goneThrough = true;
- #end
- #end
- #if (category = cosine)
- #declare varNum = 2;
- #declare varPow = 1;
- #declare varCosCooff = 8;
- #declare varX = -graphWidth;
- #declare varY = 0;
- #declare goneThrough = false;
- #while (varX < graphWidth)
- cylinder
- {
- <varX, varY, elementsZPos>
- #declare varY = varCosCooff * cos(varNum + pow(varX, varPow));
- #declare varX = varX + pointCloseness;
- <varX, varY, elementsZPos>
- #if (goneThrough)
- 0.2
- #else
- 0.0
- #end
- pigment
- {
- color rgb <0, 0, 1>
- }
- }
- #declare goneThrough = true;
- #end
- #end
- #if (category = tangent)
- #declare varNum = 2;
- #declare varPow = 1;
- #declare varTanCooff = 8;
- #declare varX = -graphWidth;
- #declare varY = 0;
- #declare goneThrough = false;
- #while (varX < graphWidth)
- cylinder
- {
- <varX, varY, elementsZPos>
- #declare varY = varTanCooff * tan(varNum + pow(varX, varPow));
- #declare varX = varX + pointCloseness;
- <varX, varY, elementsZPos>
- #if (goneThrough)
- 0.2
- #else
- 0.0
- #end
- pigment
- {
- color rgb <0, 0, 1>
- }
- }
- #declare goneThrough = true;
- #end
- #end
- #if (category = logarithm)
- #declare varNum = 2;
- #declare varPow = 1;
- #declare varLogCooff = 8;
- #declare varX = -graphWidth;
- #declare varY = 0;
- #declare goneThrough = false;
- #while (varX < graphWidth)
- #if (varNum + pow(varX, varPow) > 0)
- cylinder
- {
- <varX, varY, elementsZPos>
- #declare varY = varLogCooff * log(varNum + pow(varX, varPow));
- #declare varX = varX + pointCloseness;
- <varX, varY, elementsZPos>
- #if (goneThrough)
- 0.2
- #else
- 0.0
- #end
- pigment
- {
- color rgb <0, 0, 1>
- }
- }
- #declare goneThrough = true;
- #else
- #declare varX = varX + pointCloseness;
- #end
- #end
- #end
- #if (category = naturalLogarithm)
- #declare varNum = 2;
- #declare varPow = 1;
- #declare varLnCooff = 8;
- #declare varX = -graphWidth;
- #declare varY = 0;
- #declare goneThrough = false;
- #while (varX < graphWidth)
- #if (varNum + pow(varX, varPow) > 0)
- cylinder
- {
- <varX, varY, elementsZPos>
- #declare varY = varLnCooff * ln(varNum + pow(varX, varPow));
- #declare varX = varX + pointCloseness;
- <varX, varY, elementsZPos>
- #if (goneThrough)
- 0.2
- #else
- 0.0
- #end
- pigment
- {
- color rgb <0, 0, 1>
- }
- }
- #declare goneThrough = true;
- #else
- #declare varX = varX + pointCloseness;
- #end
- #end
- #end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement