Repository: ManimCommunity/manim
Pull request: Added ``center`` parameter to :class:`~.Sphere` and ``point`` parameter to :class:`~.Dot3D`
<!--
Thanks for your contribution to ManimCommunity!

Before filling in the details, ensure:
- Your local changes are up-to-date with ManimCommunity/manim
  
- The title of your PR gives a descriptive summary to end-users. Some examples:
  - Fixed last animations not running to completion
  - Added gradient support and documentation for SVG files
  Examples of what *NOT* to do:
  - "fixed that styling issue" - not descriptive enough
  - "fixed issue #XYZ" - end-user needs to do further research
-->
## Changelog / Overview
<!-- Optional (Recommended): a detailed overview of the PR for the upcoming
release's changelog entry. Useful for when the PR title isn't enough. 

DO NOT REMOVE THE FOLLOWING CHANGELOG LINES, EVEN IF YOU DON'T USE THEM.-->
<!--changelog-start-->
<!--changelog-end-->

## Motivation
<!-- In what way do your changes improve the library? -->

To allow a user to specify coordinates when creating a `Sphere` or `Dot3D` instead of having to create the object, then move it.

## Explanation for Changes
<!-- How do your changes improve the library?

For PRs introducing new features, please provide code snippets using the
newly introduced functionality and ideally even the expected rendered output.
-->
I updated the `__init__` methods of `Sphere` and `Dot3D` so that now a `Dot3D` can be created as follows (this example is included in the docstring for `Dot3D`):

    class Dot3DExample(ThreeDScene):
        def construct(self):
            self.set_camera_orientation(phi=75*DEGREES, theta=-45*DEGREES)

            axes = ThreeDAxes()
            dot_1 = Dot3D(point=axes.coords_to_point(0, 0, 1), color=RED)
            dot_2 = Dot3D(point=axes.coords_to_point(2, 0, 0), radius=0.1, color=BLUE)

            self.add(axes, dot_1, dot_2)
## Testing Status
<!-- Optional (Recommended): your computer specs and what tests you ran with
their results, if any. This section is also intended for other
testing-related comments. -->

## Further Comments
<!-- Optional: any further comments that might be useful for reviewers. -->
This PR is meant to fix #1429.
## Checklist
- [x] I have read the [Contributing Guidelines](https://docs.manim.community/en/latest/contributing.html)
- [x] I have written a descriptive PR title (see top of PR template for examples)
- [x] I have written a changelog entry for the PR or deem it unnecessary
- [ ] My new functions/classes either have a docstring or are private
- [ ] My new functions/classes have [tests](https://github.com/ManimCommunity/manim/wiki/Testing) added and (optional) examples in the docs
- [x] My new documentation builds, looks correctly formatted, and adds no additional build warnings
<!-- Once again, thanks for contributing to ManimCommunity! -->


<!-- Do not modify the lines below. These are for the reviewers of your PR -->
## Reviewer Checklist
- [ ] The PR title is descriptive enough
- [ ] The PR is labeled correctly
- [ ] The changelog entry is completed if necessary
- [ ] Newly added functions/classes either have a docstring or are private
- [ ] Newly added functions/classes have [tests](https://github.com/ManimCommunity/manim/wiki/Testing) added and (optional) examples in the docs
- [ ] Newly added documentation builds, looks correctly formatted, and adds no additional build warnings


Problem statement:
`Dot3D` should have a coordinate parameter
## Enhancement proposal
`Dot3D` should mirror the functionality of `Dot` and have a parameter to specify its coordinates. I think the best way to do this is to add a kwarg to `Sphere` that would also change its position, and then pass in the coordinate from `Dot3D` to the superclass init method.


## Additional comments
<!-- Add further context that you think might be relevant. -->

Hints from issue discussion:
Was thinking the same thing a while ago, seems like a good idea to me.

Commit message: feat: Added coordinate parameter to Sphere and Dot3D

Patch to review:
diff --git a/manim/mobject/three_dimensions.py b/manim/mobject/three_dimensions.py
index cb478131ab..719697f2f9 100644
--- a/manim/mobject/three_dimensions.py
+++ b/manim/mobject/three_dimensions.py
@@ -135,6 +135,7 @@ def set_fill_by_checkerboard(self, *colors, opacity=None):
 class Sphere(ParametricSurface):
     def __init__(
         self,
+        center=ORIGIN,
         radius=1,
         resolution=(12, 24),
         u_min=0.001,
@@ -155,6 +156,7 @@ def __init__(
         )
         self.radius = radius
         self.scale(self.radius)
+        self.shift(center)
 
     def func(
         self, u, v
@@ -167,6 +169,8 @@ class Dot3D(Sphere):
 
     Parameters
     --------
+    point : Union[:class:`list`, :class:`numpy.ndarray`], optional
+        The location of the dot.
     radius : :class:`float`, optional
         The radius of the dot.
     color : :class:`~.Colors`, optional
@@ -183,14 +187,14 @@ def construct(self):
                 self.set_camera_orientation(phi=75*DEGREES, theta=-45*DEGREES)
 
                 axes = ThreeDAxes()
-                dot_1 = Dot3D(color=RED).move_to(axes.coords_to_point(0, 0, 1))
-                dot_2 = Dot3D(radius=0.1, color=BLUE).move_to(axes.coords_to_point(2, 0, 0))
+                dot_1 = Dot3D(point=axes.coords_to_point(0, 0, 1), color=RED)
+                dot_2 = Dot3D(point=axes.coords_to_point(2, 0, 0), radius=0.1, color=BLUE)
 
                 self.add(axes, dot_1, dot_2)
     """
 
-    def __init__(self, radius=DEFAULT_DOT_RADIUS, color=WHITE, **kwargs):
-        Sphere.__init__(self, radius=radius, **kwargs)
+    def __init__(self, point=ORIGIN, radius=DEFAULT_DOT_RADIUS, color=WHITE, **kwargs):
+        Sphere.__init__(self, center=point, radius=radius, **kwargs)
         self.set_color(color)
 
 


Code review comments:
diff_hunk: @@ -183,14 +187,14 @@ def construct(self):
                 self.set_camera_orientation(phi=75*DEGREES, theta=-45*DEGREES)
 
                 axes = ThreeDAxes()
-                dot_1 = Dot3D(color=RED).move_to(axes.coords_to_point(0, 0, 1))
-                dot_2 = Dot3D(radius=0.1, color=BLUE).move_to(axes.coords_to_point(2, 0, 0))
+                dot_1 = Dot3D(point=axes.coords_to_point(0, 0, 1), color=RED)
+                dot_2 = Dot3D(point=axes.coords_to_point(2, 0, 0), radius=0.1, color=BLUE)
 
                 self.add(axes, dot_1, dot_2)
path: manim/mobject/three_dimensions.py
text: @user1:
```suggestion
                dot_2 = Dot3D(point=axes.coords_to_point(2, 0, 0), radius=0.1, color=BLUE)
                dot_3 = Dot3D(point=[0, 0, 0], radius=0.1, color=ORANGE)
                self.add(axes, dot_1, dot_2,dot_3)
```

@user1:
this would show, that also the syntax is also possible