The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Vector::Object3D::Point::Cast - Three-dimensional point object casting into two-dimensional surface areas

SYNOPSIS

  package Vector::Object3D::Point;

  use Moose;
  with 'Vector::Object3D::Point::Cast';

  # Calling any method from this role requires providing an object of a base class
  # and results in creation of a new instance of the same class:
  my $point = Vector::Object3D::Point->new(coord => [-2, 3, 1]);

  # Project point onto a two-dimensional plane using an orthographic projection:
  my $point2D = $point->cast(type => 'parallel');

  # Project point onto a two-dimensional plane using a perspective projection:
  my $distance = 5;
  my $point2D = $point->cast(type => 'perspective', distance => $distance);

DESCRIPTION

Vector::Object3D::Point::Cast is a Moose role that is meant to be applied to Vector::Object3D::Point class in order to provide it with additional methods of mapping three-dimensional points to a two-dimensional plane.

METHODS

cast

Project point onto a two-dimensional plane using an orthographic projection:

  my $point2D = $point->cast(type => 'parallel');

Project point onto a two-dimensional plane using a perspective projection:

  my $distance = 5;
  my $point2D = $point->cast(type => 'perspective', distance => $distance);

BUGS

There are no known bugs at the moment. Please report any bugs or feature requests.

EXPORT

Vector::Object3D::Point::Cast exports nothing neither by default nor explicitly.

SEE ALSO

Vector::Object3D::Point.

AUTHOR

Pawel Krol, <pawelkrol@cpan.org>.

VERSION

Version 0.01 (2012-12-24)

COPYRIGHT AND LICENSE

Copyright (C) 2012 by Pawel Krol.

This library is free open source software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.6 or, at your option, any later version of Perl 5 you may have available.

PLEASE NOTE THAT IT COMES WITHOUT A WARRANTY OF ANY KIND!