# TANGENT CURVE please

**URL:** <https://discourse.processing.org/t/tangent-curve-please/19838>\
**Category:** Coding Questions\
**Tags:** homework\
**Created:** [April 16, 2020, 3:38pm UTC](https://discourse.processing.org/t/tangent-curve-please/19838 "2020-04-16T15:38:38Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![onetwothree](https://avatars.discourse-cdn.com/v4/letter/o/53a042/32.png) [@onetwothree](https://discourse.processing.org/u/onetwothree)\
**Post date:** [April 16, 2020, 3:38pm UTC](https://discourse.processing.org/t/tangent-curve-please/19838/1 "2020-04-16T15:38:38Z")

</div>

Hi, someone who can help me get a code to get the tangent of the different points of a curve like the cissoid of diocles ??,

---

<div class="post-metadata">

**Author:** ![onetwothree](https://avatars.discourse-cdn.com/v4/letter/o/53a042/32.png) [@onetwothree](https://discourse.processing.org/u/onetwothree)\
**Post date:** [April 16, 2020, 4:26pm UTC](https://discourse.processing.org/t/tangent-curve-please/19838/2 "2020-04-16T16:26:19Z")

</div>

```auto
int maxX = 100; // (en direccion de negativa a positiva)
 
// ---------------------------------------------------------------
 
void setup() {
  // init
  size(900, 600);
  background(255);
 
  drawCoordSystem(); 
 
 
  // dibujar grafico
  float y; 
  PVector getScreenCoords = matchToScreenCoordinates(0,0);
  for (float x=-maxX; x < maxX; x+=.01) {
    // formulas: 
    // y = x*x;
    y = x*x;
    // aplicar el sistema de coordenadas de pantalla
    if(x > 0){
      getScreenCoords = matchToScreenCoordinates(x, y); 
      // dibujar un punto
    }
    pointPVector(getScreenCoords);
    y = -x*x;
    if(x > 0){
      getScreenCoords = matchToScreenCoordinates(x, y); 
      // dibujar un punto 
    }//PVector getScreenCoords = matchToScreenCoordinates(x, y); 
    pointPVector(getScreenCoords);
  }//for
} // función 
 
void draw() { 
 
  // cuadro de texto esquina superior izquierda 
  fill(111);
  noStroke();
  rect (0, 0, 100, 100);
  fill(255);
  text(" Plot Graph.", 30, 30);
} // funcion
 
// ---------------------------------------------------------------
 
void drawCoordSystem() {
 
  // dibujar el sistema coord en blanco
 
  // (aplicar el sistema de coordenadas de pantalla)
  PVector getScreenCoord1 = matchToScreenCoordinates(-maxX, 0);
  PVector getScreenCoord2 = matchToScreenCoordinates(maxX, 0);
  linePVectors(getScreenCoord1, getScreenCoord2);
 
  getScreenCoord1 = matchToScreenCoordinates(0, height);
  getScreenCoord2 = matchToScreenCoordinates(0, -height);
  linePVectors(getScreenCoord1, getScreenCoord2);
 
  for (int x = -10; x<10; x++) {
    getScreenCoord1 = matchToScreenCoordinates(x, -.3);
    getScreenCoord2 = matchToScreenCoordinates(x, .3);
    linePVectors(getScreenCoord1, getScreenCoord2);
  }//for
 
  for (int y = -10; y<10; y++) {
    getScreenCoord1 = matchToScreenCoordinates( -.3, y);
    getScreenCoord2 = matchToScreenCoordinates( .3, y);
    linePVectors(getScreenCoord1, getScreenCoord2);
  }//for
}//funcion 
 
// -------------------------------------------------------------------
// convertir los datos de la fórmula al formato apropiado de pantalla
 
PVector matchToScreenCoordinates (float x, float y) {
  // convertir a sistema de coordenadas de pantalla
 
  x*=40.0;
  y*=40.0; //y=y*0.019; 
  return new PVector (x+width/2, height/2-y-30);
}
 
// -------------------------------------------------------------------
// PVector funciones
 void pointPVector(PVector pv) {
  // dibujar un punto en pv
  stroke(255, 0, 0); // rojo
  point(pv.x, pv.y);
}
 
void linePVectors(PVector pv1, PVector pv2) {
  // dibujar una linea desde pv1 a pv2 
  stroke(111); // blanco
  line(pv1.x, pv1.y, 
    pv2.x, pv2.y);
}

```

this is my code

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [April 16, 2020, 6:00pm UTC](https://discourse.processing.org/t/tangent-curve-please/19838/3 "2020-04-16T18:00:56Z")

</div>

Try to find the derivative function and then display its line at the x,y position of the function

We are not allowed to do this for you so please show your attempt

Thank you!

Warm regards

Chrisir

---

<div class="post-metadata">

**Author:** ![onetwothree](https://avatars.discourse-cdn.com/v4/letter/o/53a042/32.png) [@onetwothree](https://discourse.processing.org/u/onetwothree)\
**Post date:** [April 16, 2020, 6:03pm UTC](https://discourse.processing.org/t/tangent-curve-please/19838/4 "2020-04-16T18:03:45Z")

</div>

ya tengo mi funcion derivada lo que no se es como introducirla en mi codigo, se cuales son las funciones que tengo que utilizar en mi codigo pero no como introducir mi derivada, gracias por responderme intentare hacer lo que me dice.  
Un saludo.

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [April 17, 2020, 1:01am UTC](https://discourse.processing.org/t/tangent-curve-please/19838/5 "2020-04-17T01:01:01Z")

</div>

> [@onetwothree](#):
>
> tangent

We’ve a whole batch of questions about tangent lines, recently…

[https://discourse.processing.org/search?q=tangent%20order%3Alatest](https://discourse.processing.org/search?q=tangent%20order%3Alatest)

---

<div class="post-metadata">

**Author:** ![onetwothree](https://avatars.discourse-cdn.com/v4/letter/o/53a042/32.png) [@onetwothree](https://discourse.processing.org/u/onetwothree)\
**Post date:** [April 17, 2020, 1:14am UTC](https://discourse.processing.org/t/tangent-curve-please/19838/6 "2020-04-17T01:14:50Z")

</div>

I have already discovered the code but thank you very much for answering!!

El El vie, 17 abr 2020 a las 3:11, Jeremy Douglass via Processing Foundation [processingfoundation1@discoursemail.com](mailto:processingfoundation1@discoursemail.com) escribió:
