[ 
https://issues.apache.org/jira/browse/GEOMETRY-83?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17056059#comment-17056059
 ] 

Matt Juntunen commented on GEOMETRY-83:
---------------------------------------

I'm working on adding support for circles and spheres 
[here|https://github.com/darkma773r/commons-geometry/tree/geometry-83-working]. 
The {{Sphere}} and {{Circle}} classes are not factories but actual {{Region}} 
subclasses. This makes me think that perhaps {{Parallelogram}} and 
{{Parallelepiped}} (so hard to spell!) should be {{Region}} subclasses as well. 
I think the best way to do this would be to extend {{ConvexArea}} and 
{{ConvexVolume}} respectively, which would involve modifying those classes to 
make them extensible. It would end up looking something like this:
{code:java}
public class ConvexVolume extends 
AbstractConvexHyperplaneBoundedRegion<Vector3D, ConvexSubPlane>
    implements BoundarySource3D, Linecastable3D {

    // have to use protected since not in the same package
    protected ConvexVolume(final List<ConvexSubPlane> boundaries) {
        // ...
    }
}

public class Parallelepiped extends ConvexVolume {
    private Parallelepiped(final List<ConvexSubPlane> boundaries) {
        super(boundaries);
    }

    public static Parallelepiped axisAligned(final Vector3D a, final Vector3D b,
            final DoublePrecisionContext precision) {
        // create boundaries and call ctor
    }

    // other factory methods ...
}
{code}

I think this would end up being much more useful. Thoughts?

> Shape Generation
> ----------------
>
>                 Key: GEOMETRY-83
>                 URL: https://issues.apache.org/jira/browse/GEOMETRY-83
>             Project: Apache Commons Geometry
>          Issue Type: New Feature
>            Reporter: Matt Juntunen
>            Priority: Major
>
> Add {{shapes}} packages to Euclidean 1D and 2D that contain utility classes 
> for generating boundaries for commons shapes (eg, cubes, boxes, circles, 
> spheres, etc). The functionality from the {{BoundariesXD}} utility classes 
> should be moved here.
>  
> See discussion on GEOMETRY-68.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to