Rinchi-CIGIPP

 view release on metacpan or  search on metacpan

lib/Rinchi/CIGIPP/CollisionDetectionSegmentDefinition.pm  view on Meta::CPAN


Segment ID.

This attribute specifies the identifier of the segment. If a segment is already 
defined with the same Segment ID, that segment will be overwritten.

=cut

sub segment_ident() {
  my ($self,$nv) = @_;
  if (defined($nv)) {
    $self->{'segmentIdent'} = $nv;
  }
  return $self->{'segmentIdent'};
}

#==============================================================================

=item sub segment_enable([$newValue])

 $value = $cds_def->segment_enable($newValue);

Segment Enable.

This attribute specifies whether the segment is enabled or disabled. If it is 
set to Disable (0), the specified segment is ignored during collision testing.

    Disable   0
    Enable    1

=cut

sub segment_enable() {
  my ($self,$nv) = @_;
  if (defined($nv)) {
    if (($nv==0) or ($nv==1)) {
      $self->{'segmentEnable'} = $nv;
      $self->{'_bitfields1'} |= $nv &0x01;
    } else {
      carp "segment_enable must be 0 (Disable), or 1 (Enable).";
    }
  }
  return ($self->{'_bitfields1'} & 0x01);
}

#==============================================================================

=item sub x1([$newValue])

 $value = $cds_def->x1($newValue);

X1.

This attribute specifies the X offset of one endpoint of the collision segment. 
This offset is measured with respect to the coordinate system of the entity 
specified by the Entity ID attribute. The X offset of the other endpoint is 
defined by the X2 attribute.

=cut

sub x1() {
  my ($self,$nv) = @_;
  if (defined($nv)) {
    $self->{'x1'} = $nv;
  }
  return $self->{'x1'};
}

#==============================================================================

=item sub y1([$newValue])

 $value = $cds_def->y1($newValue);

Y1.

This attribute specifies the Y offset of one endpoint of the collision segment. 
This offset is measured with respect to the coordinate system of the entity 
specified by the Entity ID attribute. The Y offset of the other endpoint is 
defined by the Y2 attribute.

=cut

sub y1() {
  my ($self,$nv) = @_;
  if (defined($nv)) {
    $self->{'y1'} = $nv;
  }
  return $self->{'y1'};
}

#==============================================================================

=item sub z1([$newValue])

 $value = $cds_def->z1($newValue);

Z1.

This attribute specifies the Z offset of one endpoint of the collision segment. 
This offset is measured with respect to the coordinate system of the entity 
specified by the Entity ID attribute. The Z offset of the other endpoint is 
defined by the Z2 attribute.

=cut

sub z1() {
  my ($self,$nv) = @_;
  if (defined($nv)) {
    $self->{'z1'} = $nv;
  }
  return $self->{'z1'};
}

#==============================================================================

=item sub x2([$newValue])

 $value = $cds_def->x2($newValue);

X2.

This attribute specifies the X offset of one endpoint of the collision segment. 
This offset is measured with respect to the coordinate system of the entity 
specified by the Entity ID attribute. The X offset of the other endpoint is 
defined by the X1 attribute.

=cut

sub x2() {
  my ($self,$nv) = @_;
  if (defined($nv)) {
    $self->{'x2'} = $nv;
  }
  return $self->{'x2'};
}

#==============================================================================

=item sub y2([$newValue])

 $value = $cds_def->y2($newValue);

Y2.

This attribute specifies the Y offset of one endpoint of the collision segment. 
This offset is measured with respect to the coordinate system of the entity 
specified by the Entity ID attribute. The Y offset of the other endpoint is 
defined by the Y1 attribute.

=cut

sub y2() {
  my ($self,$nv) = @_;
  if (defined($nv)) {
    $self->{'y2'} = $nv;
  }
  return $self->{'y2'};
}

#==============================================================================

=item sub z2([$newValue])

 $value = $cds_def->z2($newValue);

Z2.

This attribute specifies theZ offset of one endpoint of the collision segment. 
This offset is measured with respect to the coordinate system of the entity 
specified by the Entity ID attribute. The Z offset of the other endpoint is 
defined by the Z1 attribute.

=cut

sub z2() {
  my ($self,$nv) = @_;
  if (defined($nv)) {
    $self->{'z2'} = $nv;
  }
  return $self->{'z2'};
}

#==============================================================================

=item sub material_mask([$newValue])

 $value = $cds_def->material_mask($newValue);

Material Mask.

This attribute specifies the environmental and cultural features to be included 
in or excluded from consideration for collision testing. Each bit represents a 
range of material code values. Setting that bit to one (1) will cause the IG to 
register hits with materials within the corresponding range.

Refer to the appropriate IG documentation for material code assignments.

=cut

sub material_mask() {
  my ($self,$nv) = @_;
  if (defined($nv)) {
    $self->{'materialMask'} = $nv;
  }
  return $self->{'materialMask'};
}

#==========================================================================

=item sub pack()

 $value = $cds_def->pack();

Returns the packed data packet.

=cut

sub pack($) {
  my $self = shift ;
  
  $self->{'_Buffer'} = CORE::pack($self->{'_Pack'},
        $self->{'packetType'},
        $self->{'packetSize'},
        $self->{'entityIdent'},
        $self->{'segmentIdent'},
        $self->{'_bitfields1'},    # Includes bitfields unused35, and segmentEnable.
        $self->{'_unused36'},
        $self->{'x1'},
        $self->{'y1'},
        $self->{'z1'},
        $self->{'x2'},
        $self->{'y2'},
        $self->{'z2'},
        $self->{'materialMask'},
        $self->{'_unused37'},



( run in 3.122 seconds using v1.01-cache-2.11-cpan-5e09290becf )