# Shape (two parameters)

**URL:** <https://discourse.processing.org/t/shape-two-parameters/17465>\
**Category:** Coding Questions\
**Created:** [January 30, 2020, 6:31pm UTC](https://discourse.processing.org/t/shape-two-parameters/17465 "2020-01-30T18:31:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![paulstgeorge](https://avatars.discourse-cdn.com/v4/letter/p/53a042/32.png) [@paulstgeorge](https://discourse.processing.org/u/paulstgeorge)\
**Post date:** [January 30, 2020, 6:31pm UTC](https://discourse.processing.org/t/shape-two-parameters/17465/1 "2020-01-30T18:31:10Z")

</div>

I am trying to understand shape() and its two parameters. In this simple example below I have used createShape() to make two spheres. Spheres, in my world, are three-dimensional. All is fine until I get to position the spheres. Here I have only two parameters (x,y):

shape(globe, 0, 0); // two parameters?

Also, the second sphere seems to be a child of the first???

I know how to use  
translate(x, y, z);  
sphere(radius);  
But I would like to understand shape.

```auto
PShape globe;
PShape blob;

void setup() {
  size (300, 300, P3D);

  globe = createShape(SPHERE, 100);
  blob = createShape(SPHERE, 30);

  globe.setStroke(false);
  blob.setStroke(false);
  //
  globe.setFill(color(255, 0, 0));
  blob.setFill(color(255));
}

void draw() {
  background(0);

  translate(width/2, height/2); 
  rotateX(map(mouseX, 0, width, 0, TAU));
  rotateY(map(mouseY, 0, height, 0, TAU));

  shape(globe, 0, 0); // two parameters?
  shape(blob, 100, 0); // this is, strangely, relative to the globe
}

```

---

<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:** [February 19, 2020, 4:51am UTC](https://discourse.processing.org/t/shape-two-parameters/17465/2 "2020-02-19T04:51:50Z")

</div>

You are correct – place your shape sphere with `translate(x, y, z)`

As you have noticed, `sphere()` and `box()` work in the same way – the 3D primitives draw at 0,0,0 and are positioned with translate.

An interesting point of comparison to is `image()`. You can position it in 2D space with parameters, but to position it in 3D you use translate et cetera.

[https://processing.org/reference/image\_.html](https://processing.org/reference/image_.html)

The second shape is not relative to the first – both shapes are relative to the origin frame of reference you defined with translate. Because your first shape is at 0,0, the first appears relative to it, but if you give each coordinates it will be clear that they are independent.
