Skip to content

magnetic field typo? #4

Description

@i-make-robots
# Create a magnetic disc
for (i in 1:nrow(envM)){
  for (j in 1:ncol(envM)){
    if(sqrt((i-imageH/2)^2+(j-imageH/2)^2)>imageH/8 &
       sqrt((i-imageH/2)^2+(j-imageH/2)^2)<imageH/6) envM[i,j]=5
  }
}

if that is supposed to create a circle then it should use i-imageH and j-imageW something like

for (y in 1:nrow(envM)){
  for (x in 1:ncol(envM)){
    y2 = (y-imageH/2)
    x2 = (x-imageW/2)
    d = sqrt( x2*x2 + y2*y2 )
    if( d >imageH/8 & d <imageH/6) envM[i,j]=5
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions