Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove optionalTarget - part 6 #13525

Merged
merged 1 commit into from
Mar 9, 2018
Merged

Remove optionalTarget - part 6 #13525

merged 1 commit into from
Mar 9, 2018

Conversation

WestLangley
Copy link
Collaborator

As proposed in #12231.

@mrdoob mrdoob added this to the r91 milestone Mar 9, 2018
@mrdoob mrdoob merged commit 6bd09b9 into mrdoob:dev Mar 9, 2018
@mrdoob
Copy link
Owner

mrdoob commented Mar 9, 2018

Thanks!

@WestLangley WestLangley deleted the dev-optTgt_6 branch March 9, 2018 02:42
@WestLangley
Copy link
Collaborator Author

@Mugen87 @mrdoob @zz85

Ugh... I have run into a road-block with all the curve classes (and parametric geometries, apparently).

The curve classes are 2D/3D-agnostic. So one is unable to modify the codebase to pre-allocate the Vector2/3 targets, because there is no way to know in what dimension the user operating.

So, as it stands, part of the library/examples still support optionalTarget, and it is due to the getPoint() method -- and related methods.

@Mugen87
Copy link
Collaborator

Mugen87 commented Mar 9, 2018

Yeah, I remember this when I've added serialization/deserialization.

One approach that might solve the problem is to add a flag to all curve classes that indicate their respective vector space. Curve.getPoints() could look like this:

getPoints: function ( divisions ) {

	if ( divisions === undefined ) divisions = 5;

	var points = [];

	for ( var d = 0; d <= divisions; d ++ ) {

                var point = this.is2D ? new Vector2() : new Vector3();

                this.getPoint( d / divisions, point )

		points.push( point );

	}

	return points;

}

But i'm not sure how nice this is.

@WestLangley
Copy link
Collaborator Author

Maybe we should have 2D- and 3D-specific classes, instead.

@Mugen87
Copy link
Collaborator

Mugen87 commented Mar 9, 2018

Do you mean something like Curve2D and Curve3D? That would mean for example:

Curve2D -> LineCurve
Curve3D -> LineCurve3

@WestLangley
Copy link
Collaborator Author

WestLangley commented Mar 9, 2018

Yes. Just a thought...

Curve -> LineCurve
Curve3 -> LineCurve3

@WestLangley
Copy link
Collaborator Author

Oh, wait... I meant

Curve and CurvePath (2D-only)

Curve3 and CurvePath3 (3D-only)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants